Need some help with my XML Schema.

Posted by Airjoe on Stack Overflow See other posts from Stack Overflow or by Airjoe
Published on 2010-04-14T19:34:51Z Indexed on 2010/04/14 19:43 UTC
Read the original article Hit count: 375

Filed under:
|
|

I'm using Qt C++ and am reading in an XML file for data. I want to ensure the XML file contains valid elements, so I began to write an XML Schema to validate against (Qt doesn't support validating against a DTD). The problem is, I'm not sure if my Schema itself is valid, and I can't seem to find an actual XSD validator. I tried using the official w3c validator at http://www.w3.org/2001/03/webdata/xsv, but it's giving me blank output. Would anyone know of a decent XSD validator, or perhaps be willing to look over the following manually?

    <?xml version="1.0"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
<xs:element name="ballot">
  <xs:complexType>
    <xs:sequence>
      <xs:element name="races">
        <xs:complexType>
          <xs:element name="race" minOccurs="1" maxOccurs="unbounded">
            <xs:complexType>
              <xs:sequence>
                <xs:element name="rtitle" minOccurs="1" maxOccurs="1" type="xs:string"/>
                <xs:element name="candidates" minOccurs="1" maxOccurs="1">
                  <xs:complexType>
                    <xs:element name="candidate" minOccurs="1" maxOccurs="10">
                      <xs:complexType>
                        <xs:element name="candname" minOccurs="1" maxOccurs="1" type="xs:string"/>
                        <xs:element name="candparty" minOccurs="1" maxOccurs="1" type="xs:string"/>
                      </xs:complexType>
                    </xs:element>
                  </xs:complexType>
                </xs:element>
              </xs:sequence>
            </xs:complexType>
          </xs:element>
        </xs:complexType>
      </xs:element>
      <xs:element name="propositions">
          <xs:complexType>
              <xs:element name="proposition" minOccurs="1" maxOccurs="unbounded">
                  <xs:complexType>
                      <xs:element name="ptitle" minOccurs="1" maxOccurs="1" type="xs:string"/>
                      <xs:element name="pdesc" minOccurs="1" maxOccurs="1" type="xs:string"/>
                  </xs:complexType>              
              </xs:element>
          </xs:complexType>
       </xs:element>
    </xs:sequence>
  </xs:complexType>
</xs:element>
</xs:schema>

Please let me know what you think, I appreciate it!

© Stack Overflow or respective owner

Related posts about xsd

Related posts about schema