XML File
<?xml version="1.0" encoding="UTF-8"?>
<rootItem xmlns="http://ift.tt/rAg5Mm"
xmlns:xsi="http://ift.tt/ra1lAU"
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="software" type="individual" currentlyOffered="Y">
<tid>663</tid>
<tname>Windows</tname>
<reviewDate>2015-08-06</reviewDate>
<note staffID="ef28xmm">Do we need to ensure that people aren't trying to put it on a calculator?</note>
</product>
<product category="software" type="group" currentlyOffered="Y">
<tid>412</tid>
<tname>Football Manager</tname>
<reviewDate>2016-09-16</reviewDate>
</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 that this is suitable for minors</note>
<note staffID="mm25por">Need to check price on this</note>
</product>
</rootItem>
XML Schema
<!-- 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>
<xs:restriction base="xs:string">
<xs:length value="7"/>
<xs:pattern value="[a-z][a-z][0-9][0-9][a-z][a-z][a-z]"/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<!-- definition of complex elements -->
<xs:element name="product">
<xs:complexType>
<xs:sequence>
<xs:element ref="tid"/>
<xs:element ref="tname"/>
<xs:element ref="reviewDate"/>
<xs:element ref="note" minOccurs="0" maxOccurs="unbounded" />
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="rootItem">
<xs:complexType>
<xs:sequence>
<xs:element ref="product"/>
</xs:sequence>
<xs:attribute ref="category" use="required"/>
<xs:attribute ref="type" use="required"/>
<xs:attribute ref="currentlyOffered" use="required"/>
</xs:complexType>
</xs:element>
</xs:schema>
And the response I get is "Cannot find the declaration of element 'rootItem' (note that I've changed names of things for reasons of confidentiality).
Any ideas? XML schemas really aren't something I'm especially good at.
Aucun commentaire:
Enregistrer un commentaire