次の 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>
そのための XSD スキーマを作成します。
<word>
何らかの理由で要素の定義を正しく取得できません。これまでに思いついたのは次のとおりです。
<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>
しかし、私が走るとき
xmllint -noout -schema wordlist.xsd
私は得る
dictionary.xml:11: element word: Schemas validity error : Element 'word': This element is not expected.
dictionary.xml fails to validate
11号線は
<word id="1">Triangle</word>
したがって、最初の単語は期待どおりに機能するようですが、2番目の単語は機能しません...