Resource Files (sl-valid.xml, sl-notValid.xml, and sl.xsd)

 

The resource files shown in this topic are for use with the following examples:

XML Data File (sl-valid.xml)

<?xml version="1.0"?>
<catalog xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'
         xsi:schemaLocation='urn:book sl.xsd'>
   <x:book 
      xmlns:x='urn:book'
      id="bk101">
      <x:author>Gambardella, Matthew</x:author>
      <x:title>XML Developer's Guide</x:title>
      <x:genre>Computer</x:genre>
      <x:price>44.95</x:price>
      <x:publish_date>2000-10-01</x:publish_date>
      <x:description>An in-depth look at creating applications with
      XML.</x:description>
   </x:book>
</catalog>

XML Data File (sl-notValid.xml)

<?xml version="1.0"?>
<catalog xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'
         xsi:schemaLocation='urn:book sl.xsd'>
   <x:book 
      xmlns:x='urn:book'
      id="bk101">
      <x:author>Gambardella, Matthew</x:author>
      <x:title>XML Developer's Guide</x:title>
      <x:genre>Computer</x:genre>
      <x:cost>44.95</x:cost>
      <x:publish_date>2000-10-01</x:publish_date>
      <x:description>An in-depth look at creating applications with
      XML.</x:description>
   </x:book>
</catalog>

XSD Schema File (sl.xsd)

<?xml version="1.0"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
            xmlns:x="urn:book"
            targetNamespace="urn:book"
            elementFormDefault="qualified">
<!--  *** Add the following if attributes 
          are to be namespace prefixed ***
            attributeFormDefault="qualified">
-->  
  <xsd:element name="book">
  <xsd:complexType>
    <xsd:sequence>
      <xsd:element name="author" type="xsd:string"/>
      <xsd:element name="title" type="xsd:string"/>
      <xsd:element name="genre" type="xsd:string"/>
      <xsd:element name="price" type="xsd:float"/>
      <xsd:element name="publish_date" type="xsd:date"/>
      <xsd:element name="description" type="xsd:string"/>
    </xsd:sequence>
    <xsd:attribute name="id" type="xsd:string"/>
  </xsd:complexType>
  </xsd:element>
</xsd:schema>