0

我正在为dredmor的地牢制作一个mod。当我通过语法检查器或格式化程序运行代码时,我收到此错误:

无法解析任何 XML 输入。第 6 行错误:元素类型“skillDB”必须由匹配的结束标记“ </skillDB>”终止。

这是我的 XML:

<skillDB>
<skill name="Gamblemancy" skillName="Gamblemancer" type="wizard" 
description="The magic of the felt. Will you heal your enemies? Hurt yourself? It's up to the dice! Or cards. Or slot machine"/>
    <art icon="\sprites\fillersprite.png" />
    <loadout type="booze" subtype="Deck Of Cards" />
</skill>
<ability>
    <name="Gamblemancy" icon="\sprites\fillersprite.png skillName="Gamblemancer" startSkill="1"
description="You are a gamblemancer! A holder of ultimate luck! And Debt!"/>
    <primarybuff id="5" amount="2" />
    <secondarybuff id="5" amount="2" />
</ability>
<ability>
    <name="Luck of the draw" icon="\sprites\fillersprite.png" skillName="Gamblemancer" level="0"
    description text="Pure luck courses through your veins! Except when it doesn't." />
    <criticalBuff percentage="90" name="Lucky shot" />
</ability>
<ability>
<name="Royal flush" icon="\sprites\fillersprite.png skillName="Gamblemancer" level="1"
description text="Royal Flush! You win! Except that you don't!" />
<spell name="Royal Flush" />
</ability>
<skill skillName="Another skill tree's name">
    <!--This is where some basic information about the skill tree goes-->
</skill>
  <ability skillName="Another skill tree's name" startSkill="1">
      <!--This is where the first level of the skill tree goes-->
  </ability>
  <ability skillName="Another skill tree's name" level="0">
      <!--This is where the second level of the skill tree goes-->
  </ability>
  <ability skillName="Another skill tree's name" level="1">
      <!--This is where the third level of the skill tree goes-->
  </ability>
 </skillDB>
4

1 回答 1

2

您的 XML 存在几个语法问题,包括:

  1. 第一个skill元素有一个自闭合的开始标签和一个结束标签。删除/字符:

    <skill name="Gamblemancy" skillName="Gamblemancer" type="wizard"
           description="The magic of the felt. Will you heal your enemies? 
           Hurt yourself? It's up to the dice! Or cards. Or slot machine"/>
                                                                         ^
    

    或删除结束标签:

    </skill>
    
  2. <name="Gamblemancy" 缺少标签名称。

  3. 属性值缺少右引号。

太多了,如果没有 XML 模式或已知的有效文档实例样本,就很难知道如何修复。这是一种至少形式良好的可能性:

<skillDB>
  <skill name="Gamblemancy" skillName="Gamblemancer" type="wizard" 
         description="The magic of the felt. Will you heal your enemies? Hurt yourself? It's up to the dice! Or cards. Or slot machine">
    <art icon="\sprites\fillersprite.png"/>
    <loadout type="booze" subtype="Deck Of Cards"/>
    <ability>
      <NEEDTAG name="Gamblemancy" icon="\sprites\fillersprite.png" skillName="Gamblemancer" startSkill="1"
               description="You are a gamblemancer! A holder of ultimate luck! And Debt!"/>
      <primarybuff id="5" amount="2" />
      <secondarybuff id="5" amount="2" />
    </ability>
    <ability>
      <NEEDTAG name="Luck of the draw" icon="\sprites\fillersprite.png" skillName="Gamblemancer" level="0"
               description="Pure luck courses through your veins! Except when it doesn't." />
      <criticalBuff percentage="90" name="Lucky shot" />
    </ability>
    <ability>
      <NEEDTAG name="Royal flush" icon="\sprites\fillersprite.png" skillName="Gamblemancer" level="1"
               description="Royal Flush! You win! Except that you don't!" />
      <spell name="Royal Flush" />
    </ability>
  </skill>
  <skill skillName="Another skill tree's name">
    <!--This is where some basic information about the skill tree goes-->
  </skill>
  <ability skillName="Another skill tree's name" startSkill="1">
    <!--This is where the first level of the skill tree goes-->
  </ability>
  <ability skillName="Another skill tree's name" level="0">
    <!--This is where the second level of the skill tree goes-->
  </ability>
  <ability skillName="Another skill tree's name" level="1">
    <!--This is where the third level of the skill tree goes-->
  </ability>
</skillDB>
于 2020-11-09T17:37:53.460 回答