xml schema validation, please help I am student that is stuck!

Discussion in 'XML & RSS' started by cdpowell, Nov 8, 2007.

  1. #1
    <?xml version="1.0"?>

    <xsd:schema xmlns:xsd= "http://www.w3.org/2001/XMLSchema">

    <xsd:element name="libray" type="libray"/>
    <xsd:complexType name="libray">
    <xsd:sequence>
    <xsd:element name="item" type="xsd:integer"
    maxOccurs="unbounded"/>
    </xsd:sequence>
    </xsd:complexType>

    <xsd:complexType name="item">
    <xsd:sequence>
    <xsd:element name="number" type="xsd:integer"/>
    <xsd:element name="material" type="xsd:string"/>
    <xsd:element name="name" type="xsd:string"/>
    <xsd:element name="title" type="xsd:string"/>
    <xsd:element name="publisher" type="xsd:string"/>
    <xsd:element name="place" type="xsd:string"/>
    <xsd:element name="date" type="xsd:date"/>
    <xsd:element name="pagination" type="xsd:integer"/>
    <xsd:element name="description" type="xsd:string" minOccurs="0"/>
    <xsd:element name="isbn" type="xsd:integer" minOccurs="0"/>
    </xsd:sequence>
    </xsd:complexType>


    <xsd:element name="item2"/>
    <xsd:complexType name="item2">
    <xsd:sequence>
    <xsd:element ref="number"/>
    <xsd:element ref="material"/>
    <xsd:element ref="name"/>
    <xsd:element ref="title"/>
    <xsd:element ref="publisher"/>
    <xsd:element ref="place"/>
    <xsd:element ref="date"/>
    <xsd:element ref="pagination"/>
    <xsd:element ref="description"/>
    <xsd:element ref="isbn"/>
    </xsd:sequence>
    </xsd:complexType>
    </xsd:schema>
    --------------------------------------------------------------------------
    <?xml version="1.0"?>
    <myLibrary>
    <item>
    <number>96050228</number>
    <material>Book (Print, Micro form, Electronic, etc.)</material>
    <name>McCourt, Frank</name>
    <title>Angela's ashes : a memoir</title>
    <publisher>Wheeler Publisher</publisher>
    <place>Rockland, MA</place>
    <date>1997</date>
    <pagination>517 p.</pagination>
    <description>24 cm.</description>
    <isbn>1568953968</isbn>
    </item>
    <item>
    <number>99025057</number>
    <material>Book (Print, Micro form, Electronic, etc.)</material>
    <name>Castillo, Ana</name>
    <title>Peel my love like an onion</title>
    <publisher>Doubleday</publisher>
    <place>New York</place>
    <date>1999</date>
    <pagination>213 p.</pagination>
    <description>22 cm.</description>
    <isbn>0385496761</isbn>
    </item>
    <item>
    <number>2004577077</number>
    <material>Compact Disc Music Sound Recording</material>
    <name>Urban, Keith</name>
    <title>Somebody like you</title>
    <company>Capitol Records</company>
    <place>United States</place>
    <year>2002</year>
    <description>4 3/4 in</description>
    </item>
    <item>
    <number>2004591490</number>
    <material>Compact Disc Music Sound Recording</material>
    <name>Urban, Keith</name>
    <title>Be here </title>
    <company>Capitol Records</company>
    <place>Nashville, TN</place>
    <year>200</year>
    <description>4 3/4 in</description>
    </item>
    </myLibrary>
     
    cdpowell, Nov 8, 2007 IP