简体   繁体   English

元素类型“xsd:schema”必须由匹配的结束标签“”终止

[英]The element type “xsd:schema” must be terminated by the matching end-tag “</xsd:schema>”

<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
    targetNamespace="http://xml.netbeans.org/schema/books"
    xmlns:tns="http://xml.netbeans.org/schema/books"
    elementFormDefault="qualified">
    
    <xsd:complexType name="Mcdonalds">
        <xsd:sequence>
            <xsd:element name="Apple pie" type="xsd:date"/>
            <xsd:element name="Mcflurry" type="xsd:string"/>
            <xsd:element name="Fries" type="xsd:double"/>
        </xsd:sequence>
    </xsd:complexType>
    
      <xsd:complexType name="Five guys">
        <xsd:sequence>
            <xsd:element name="Large fries" type="xsd:string"/>
            <xsd:element name="small burger" type="xsd:string"/>
            <xsd:element name="hotdog" type="xsd:int"/>
            <xsd:element name="cost" type="xsd:double"/>
        </xsd:sequence>
      </xsd:complexType>
</xsd:schema>

I'm trying to bind my XSD file, but I've been receiving this error and I don't see any problems.我正在尝试绑定我的 XSD 文件,但我一直收到此错误并且我没有看到任何问题。

ERROR:错误:

The element type:元素类型:

"[ERROR] The element type "xsd:schema" must be terminated by the matching end-tag "</xsd:schema>" "[ERROR] 元素类型 "xsd:schema" 必须由匹配的结束标记 "</xsd:schema>" 终止

You are not running the validator on the same XSD that you've posted (or your XSD processor is badly broken).您没有在您发布的同一个 XSD 上运行验证器(或者您的 XSD 处理器严重损坏)。

Your posted XSD should not result in the posted error regarding a missing end-tag for xsd:schema .您发布的 XSD不应导致发布有关xsd:schema缺少结束标签的错误。

Use proper NCNames for elements – no spaces, as @YitzhakKhabinsky has already mentioned (+1):为元素使用正确的 NCNames - 没有空格,正如@YitzhakKhabinsky 已经提到的(+1):

<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
            targetNamespace="http://xml.netbeans.org/schema/books"
            xmlns:tns="http://xml.netbeans.org/schema/books"
            elementFormDefault="qualified">
  
  <xsd:complexType name="Mcdonalds">
    <xsd:sequence>
      <xsd:element name="ApplePie" type="xsd:date"/>
      <xsd:element name="Mcflurry" type="xsd:string"/>
      <xsd:element name="Fries" type="xsd:double"/>
    </xsd:sequence>
  </xsd:complexType>
  
  <xsd:complexType name="FiveGuys">
    <xsd:sequence>
      <xsd:element name="LargeFries" type="xsd:string"/>
      <xsd:element name="SmallBurger" type="xsd:string"/>
      <xsd:element name="hotdog" type="xsd:int"/>
      <xsd:element name="cost" type="xsd:double"/>
    </xsd:sequence>
  </xsd:complexType>
</xsd:schema>

The above XSD is syntactically correct.上面的 XSD 在语法上是正确的。 Use it exactly for your next test.将它完全用于您的下一次测试。 Note, however, the following:但是,请注意以下几点:

  1. The semantics of associating the cost element with FiveGuys rather than with each menu item, perhaps as an attribute rather than an element, is dubious.cost元素与FiveGuys而不是与每个菜单项相关联的语义,也许是作为一个属性而不是一个元素,是值得怀疑的。

  2. You currently have no root-level elements defined, only types.您目前没有定义根级元素,只有类型。

I validated the XSD by using Saxon.我使用 Saxon 验证了 XSD。 Here is the output of it.这是它的output。

Please try to remove spaces in the element names.请尝试删除元素名称中的空格。

Running custom validation engine Saxonica 9.7.0.15 Validator...

file:/e:/Temp/dummy.xsd:9 Fatal Error: Invalid QName {Apple pie}
file:/e:/Temp/dummy.xsd:15 Fatal Error: Invalid QName {Five guys}
file:/e:/Temp/dummy.xsd:17 Fatal Error: Invalid QName {Large fries}
file:/e:/Temp/dummy.xsd:18 Fatal Error: Invalid QName {small burger}

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 元素类型“xsd:sequence”必须由匹配的结束标签“”终止 - The element type “xsd:sequence” must be terminated by the matching end-tag “</xsd:sequence>” 元素类型“标签”必须以匹配的结束标签“</tag> ” - The element type "tag" must be terminated by the matching end-tag "</tag>" XSD元素类型不会以匹配的结束标签终止 - XSD element type won't terminate with matching end-tag 元素类型“META”必须以匹配的结束标签“</META> ” - The element type “META” must be terminated by the matching end-tag “</META>” 元素类型 X 必须由匹配的结束标记终止 - The element type X must be terminated by the matching end-tag SaxParseException 元素类型“hr”必须由匹配的结束标记“终止</hr> “。在使用 jaxb 读取 xml 时 - SaxParseException The element type "hr" must be terminated by the matching end-tag "</hr>". while reading xml with jaxb “img”必须由匹配的end-tag终止 - “img” must be terminated by the matching end-tag 如何解决这个错误“元素类型”头“必须由匹配的结束标记”</ head>“终止>? - How to solve this error “The element type ”head“ must be terminated > by the matching end-tag ”</head>"? TypeError:错误#1085:元素类型“ opi1”必须以匹配的结束标记“ </opi1> ” - TypeError: Error #1085: The element type “opi1” must be terminated by the matching end-tag “</opi1>” hive-site.xml:元素类型“configuration”必须由匹配的end-tag终止“ </configuration> ” - hive-site.xml: The element type “configuration” must be terminated by the matching end-tag “</configuration>”
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM