2011-07-07 47 views
0

我與XML文件沒有好,但我需要用一個進行測試,它看起來像它的錯誤寫入:無效的XML文件?

<?xml version="1.0" encoding="UTF-8"?> 
<root> 
    <command action="send" id="1234" [reconnect_after = 0] > 
     <clip id="1">PD94bWwgdmVyc2lvbj0iMS4wIiBlb</clip> 
     <clip id="2">kjshdf23987iewjfnb892q34qdhadhax</clip> 
    </command> 
</root> 

我有一個XML驗證測試,這些都是結果:

Error: Can not find declaration of element 'root'. 
    Error Position: 
<root> 

Error: Element type "command" must be followed by attribute specifications: ">" or "/>". 
    Error Position: 
<command action="resolve" id="1234" [reconnect_after = 0] > 

儘管有錯誤說明,但我真的不知道如何更正文件。誰能幫我?

謝謝。

回答

4

reconnect_after="0"替換[reconnect_after = 0]

+0

現在在我的測試程序中完美工作,儘管驗證器仍然說了一些關於根標籤的內容。 – Kobe

+1

該警告僅僅是因爲驗證程序沒有DTD或Schema來檢查XML是否符合規則。例如,它想知道是否允許命令包含剪輯元素。 –