Let's say I have the following XML:
<wordlist>
<language>English</language>
<author>John Smith</author>
<words>
<word id="0">Point</word>
<word id="1">Triangle</word>
<word id="2">Apple</word>
<word id="3">Plate</word>
<word id="4">Mango</word>
<word id="5">Computer</word>
</words>
</wordlist>
and want to create an XSD schema for it.
I can't get the definition for the <word>
elements right for some reason. What I've come up with so far is:
<xs:element name="wordlist">
<xs:complexType>
<xs:sequence>
<xs:element name="language" type="xs:string" />
<xs:element name="author" type="xs:string" />
<xs:element name="words">
<xs:complexType>
<xs:sequence>
<xs:element name="word">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute name="id" type="xs:integer" use="required"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
but when I run
xmllint -noout -schema wordlist.xsd
I get
dictionary.xml:11: element word: Schemas validity error : Element 'word': This element is not expected.
dictionary.xml fails to validate
Line 11 is
<word id="1">Triangle</word>
so it seems the first word works as expected, but not the second one...