Issue
<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.
ERROR:
The element type:
"[ERROR] The element type "xsd:schema" must be terminated by the matching end-tag "</xsd:schema>"
Solution
You are not running the validator on the same XSD that you've posted (or your XSD processor is badly broken).
Your posted XSD should not result in the posted error regarding a missing end-tag for xsd:schema
.
Use proper NCNames for elements – no spaces, as @YitzhakKhabinsky has already mentioned (+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. Use it exactly for your next test. Note, however, the following:
The semantics of associating the
cost
element withFiveGuys
rather than with each menu item, perhaps as an attribute rather than an element, is dubious.You currently have no root-level elements defined, only types.
Answered By - kjhughes
Answer Checked By - Clifford M. (JavaFixing Volunteer)