【问题标题】:XML Parsing error at line N extra content at the end of the document文档末尾第 N 行额外内容的 XML 解析错误
【发布时间】:2020-04-11 23:32:57
【问题描述】:

已经为此苦苦挣扎了一段时间,但我不确定问题出在哪里。 (使用验证工具)我得到的错误是

文档末尾第 11 行的 XML 解析错误。

<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" >
 </xs:schema>
  <xs:element name="Artworks" type="artworkinfo"/>
     <xs:complexType name="artworkinfo">
      <xs:sequence>

        <xs:element name="title" type="xs:string"/>
        <xs:element name="media" type="xs:string"/>
        <xs:element name="description" type="xs:string"/>
        <xs:element name="created" type="xs:string"/>
        <xs:element name="display" type="xs:string"/>
      </xs:sequence>
    </xs:complexType>

【问题讨论】:

    标签: xml xsd xsd-validation xml-validation


    【解决方案1】:

    你必须至少解决这两个问题:

    1. 您关闭第 2 行上的 xs:schema 标记,在 XSD 的其余部分之前。

    2. 您在第 3 行使用了一个自动关闭的 xs:element 标记,您可能希望它成为下一行中 xs:complexType 元素的父级。

    一般来说,错误是由于违反了XML 文档只允许有单个根元素的规则。单个根元素后面不能有任何标记。

    【讨论】:

    • 这样做了,但现在我收到了“需要属性名称但缺少”错误
    • 发布一个新问题,minimal reproducible example 说明新问题。包括复制和粘贴的确切错误,而不是解释。
    猜你喜欢
    • 1970-01-01
    • 2013-06-03
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-05-27
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多