Chase N.Проверка правильности XML

       

Полные документы схемы и экземпляра


Документ схемы XML:

<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <xsd:element name="memories"> <xsd:complexType> <xsd:sequence> <xsd:element name="memory" minOccurs = "0" maxOccurs="unbounded" type="memoryType"/> </xsd:sequence> </xsd:complexType> </xsd:element> <xsd:complexType name="memoryType"> <xsd:sequence> <xsd:element name="media"> <xsd:complexType> <xsd:attribute name="mediaid" type="xsd:integer" /> <xsd:attribute name="status" type="mediaType" /> </xsd:complexType> </xsd:element> <xsd:element name="subdate" type="xsd:date"/> <xsd:element name="donor" type="xsd:string"/> <xsd:element name="subject"> <xsd:complexType mixed="true"> <xsd:all> <xsd:element name="i" minOccurs="0" maxOccurs="1" type="xsd:string" /> <xsd:element name="b" minOccurs="0" maxOccurs="1" type="xsd:string" /> </xsd:all> </xsd:complexType> </xsd:element> <xsd:element name="location" type="locationType" /> </xsd:sequence> <xsd:attribute name="tapeid" type="idNumber" /> <xsd:attribute name="status" type="xsd:string" /> </xsd:complexType> <xsd:complexType name="locationType"> <xsd:choice> <xsd:element name="description" type="xsd:anyType" /> <xsd:element name="place" type="xsd:string" /> </xsd:choice> </xsd:complexType> <xsd:simpleType name="idNumber"> <xsd:restriction base="xsd:integer"> <xsd:minInclusive value="1" /> <xsd:maxInclusive value="100000" /> </xsd:restriction> </xsd:simpleType> <xsd:simpleType name="mediaType"> <xsd:restriction base="xsd:string"> <xsd:enumeration value="8mm" /> <xsd:enumeration value="vhs" /> <xsd:enumeration value="vhsc" /> <xsd:enumeration value="digital" /> <xsd:enumeration value="audio" /> </xsd:restriction> </xsd:simpleType> </xsd:schema>

Документ экземпляра:

<?xml version="1.0"?> <memories xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xsi:noNamespaceSchemaLocation='memory.xsd'> <memory tapeid="1"> <media mediaid="1" status="vhs" /> <subdate>2001-05-23</subdate> <donor>John Baker</donor> <subject>Fishing off Pier 60</subject> <location> <description>Outside in the woods</description> </location> </memory> <memory tapeid="2"> <media mediaid="2" status="vhs"/> <subdate>2001-05-18</subdate> <donor>Elizabeth Davison</donor> <subject>Beach volleyball</subject> <location> <place>Clearwater beach</place> </location> </memory> </memories>



Содержание раздела