File: Data.xml
<?xml version="1.0"?>
<library xmlns="http://java2s.com/ns/library">
<book id="b0836217462" available="yes">
<isbn>1</isbn>
<title>Full-Time Job</title>
<authors>
<person id="i1">
<name>A</name>
<born>1999-11-26</born>
<dead>2000-02-12</dead>
</person>
</authors>
<characters>
<person id="i2">
<name>B</name>
<born>1966-08-22</born>
<qualification>bold, brash and tomboyish</qualification>
</person>
<person id="i3">
<name>Snoopy</name>
<born>1950-10-04</born>
<qualification>extroverted beagle</qualification>
</person>
</characters>
</book>
</library>
File: Schema.xsd
<?xml version="1.0"?>
<schema targetNamespace="http://java2s.com/ns/library"
elementFormDefault="qualified" attributeFormDefault="unqualified"
xmlns="http://www.w3.org/2001/XMLSchema"
xmlns:lib="http://java2s.com/ns/library">
<element name="library">
<complexType>
<sequence>
<element name="book" type="lib:bookType" />
</sequence>
</complexType>
</element>
<element name="person">
<complexType>
<sequence>
<element name="name" type="string" />
<element name="born" type="date" />
<element name="dead" type="date" minOccurs="0" />
<element name="qualification" type="string"
minOccurs="0" />
</sequence>
<attribute name="id" type="ID" use="required" />
</complexType>
</element>
<complexType name="bookType">
<sequence>
<element name="isbn" type="string" />
<element name="title" type="string" />
<element name="authors">
<complexType>
<sequence>
<element ref="lib:person" maxOccurs="unbounded" />
</sequence>
</complexType>
</element>
<element name="characters">
<complexType>
<sequence>
<element ref="lib:person" maxOccurs="unbounded" />
</sequence>
</complexType>
</element>
</sequence>
<attribute name="id" type="ID" use="required" />
<attribute name="available" type="string" use="required" />
</complexType>
</schema>
|