XML 文件:
<?xml version="1.0" encoding="UTF-8"?>
<rootItem xmlns="http://www.w3schools.com"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="schema.xsd">
<product category="software" type="individual" currentlyOffered="Y">
<tid>725</tid>
<tname>MS Office</tname>
<reviewDate>2017-12-05</reviewDate>
<note staffID="ee21kfj">Need to specify Windows version</note>
<note staffID="ef23mls">Is there a price update?</note>
</product>
<product category="hardware" type="individual" currentlyOffered="TBC">
<tid>511</tid>
<tname>Mouse</tname>
<reviewDate>2016-09-26</reviewDate>
<note staffID="fh26eij">Need to ensure ... minors</note>
<note staffID="mm25por">Need to check ... this</note>
</product>
</rootItem>
XML 架构:
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<!-- definition of simple elements -->
<xs:element name="tid" type="xs:positiveInteger"/>
<xs:element name="tname" type="xs:string"/>
<xs:element name="reviewDate" type="xs:date"/>
<xs:element name="note" type="xs:string"/>
<!-- definition of attributes -->
<xs:attribute name="category" type="xs:string"/>
<xs:attribute name="type" type="xs:string"/>
<xs:attribute name="currentlyOffered" type="xs:string"/>
<xs:attribute name="staffID">
<xs:simpleType>
<!-- Some Rules -->
</xs:simpleType>
</xs:attribute>
<!-- definition of complex elements -->
<xs:element name="product">
<xs:complexType>
<xs:sequence>
<!-- Some Rules -->
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="rootItem">
<xs:complexType>
<!-- Some Rules -->
</xs:complexType>
</xs:element>
</xs:schema>
我得到的回应是:
"Cannot find the declaration of element 'rootItem'.
有任何想法吗?