如何纠正标签不匹配错误?

时间:2015-03-14 16:29:01

标签: xml xml-validation

我已经创建了一个network xml文件,要解析为Java应用程序。但是当我验证xml文件时,我收到以下错误:

"第71行,第14列:元素的结束标记"位置"这是不公开的"

为了调试这个,我检查了我的开始和结束标签,但我没有看到任何错误。

任何人都可以找到标签错误的位置吗?

<?xml version="1.0" encoding="UTF-8"?>
<network>
  <locations>
   <location>
    <location name="Tiberius"/>
    <location description="You are in the Kingdom of Tiberias at the start of your journey.."/>
    <objects>
        <object type = "sword" life = "-0.5"/>
        <object type = "food" life = "+0.5"/>
        <object type = "medicine" life = "+1.0"/>
        <object type = "ale" life = "+0.2"/>
        <object type = "shield" life = "+0.4"/>
    </objects>
    <character>
        <character type = "Saracen" life = "10"/>
        <character type = "Knights Hospitaller" life = "10"/>
        <character type = "Knights Templar" life = "10"/>
        <character type = "Principality of Antioch" life = "10"/>
        <character type = "Order of Saint" life = "10"/>
        <character type = "Lazarus" life = "10"/>
        <character type = "Ayyubids" life = "10"/>
    </character>
    <exits>
        <exit name="Jerusalem" direction="S"/>
    </exits>
   </location>
   <location>
    <location name="Jerusalem"/>
    <location description="You are in the Kingdom of Jerusalem.."/>
    <objects>
        <object type = "sword" life = "-0.5"/>
        <object type = "food" life = "+0.5"/>
        <object type = "medicine" life = "+1.0"/>
        <object type = "ale" life = "+0.2"/>
        <object type = "shield" life = "+0.4"/>
    </objects>
    <character>
        <character type = "Saracen" life = "10"/>
        <character type = "Knights Hospitaller" life = "10"/>
        <character type = "Knights Templar" life = "10"/>
        <character type = "Principality of Antioch" life = "10"/>
        <character type = "Order of Saint" life = "10"/>
        <character type = "Lazarus" life = "10"/>
        <character type = "Ayyubids" life = "10"/>
    </character>
    <exits>
        <exit name="Lod" direction="W"/>
    </exits>
   </location>
   <location name="Lod"/>
    <location description="You are in the Kingdom of Lod.."/>
    <objects>
        <object type = "sword" life = "-0.5"/>
        <object type = "food" life = "+0.5"/>
        <object type = "medicine" life = "+1.0"/>
        <object type = "ale" life = "+0.2"/>
        <object type = "shield" life = "+0.4"/>
    </objects>
    <character>
        <character type = "Saracen" life = "10"/>
        <character type = "Knights Hospitaller" life = "10"/>
        <character type = "Knights Templar" life = "10"/>
        <character type = "Principality of Antioch" life = "10"/>
        <character type = "Order of Saint" life = "10"/>
        <character type = "Lazarus" life = "10"/>
        <character type = "Ayyubids" life = "10"/>
    </character>
    <exits>
        <exit name="Haifa" direction="N"/>
    </exits>
   </location>
  </locations>
  <edges>
   <edge>
    <edge direction="S" from = "Tiberius" to="Jerusalem" weight="10" danger="7"/> 
   </edge>
   <edge>
    <edge direction="W" from = "Jerusalem" to="Lod" weight="8" danger="10"/> 
   </edge>
   <edge>
    <edge direction="N" from = "Lod" to="Haifa" weight="23" danger="5"/> 
   </edge>
  </edges>
</network>

1 个答案:

答案 0 :(得分:1)

在此行<location name="Lod"/>之上添加开始标记<location>,希望这可以解决您的问题。如果您需要任何帮助,请告诉我