Microsoft XML Core Services (MSXML) 5.0 for Microsoft Office - SAX2 Developer's Guide

Sample XSD Schema File (SAX Validator)

To validate the sample XML file (books.xml), you must create an XSD schema file.

To create the sample XSD schema file

  1. Open Notepad.
  2. Select the code for books.xsd (below). Then copy it and paste it in Notepad.
  3. From Notepad, save the file as books.xsd to the same folder where you are creating the SAX Validator application.

Complete Code for books.xsd

<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <xsd:element name="catalog">
    <xsd:complexType>
      <xsd:sequence>
        <xsd:element name="book" minOccurs="0" maxOccurs="unbounded">
          <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:sequence>
    </xsd:complexType>
  </xsd:element>
</xsd:schema>
Note   For the SAX validator application to work properly, you must copy and save the sample XML file (books.xml) to the same folder.

See Also

Validate Documents Using SAX | Overview of the SAX Validator Application | Application Form (SAX Validator) | MyValidator Class (SAX Validator) | Run the Application (SAX Validator) | How the SAX Validator Application Works