Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 733859
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T07:18:18+00:00 2026-05-14T07:18:18+00:00

I’m using Qt C++ and am reading in an XML file for data. I

  • 0

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!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T07:18:19+00:00Added an answer on May 14, 2026 at 7:18 am

    xs:element can’t go directly inside of xs:complexType. Try this:

    <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:sequence>
                  <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:sequence>
                              <xs:element name="candidate" minOccurs="1" maxOccurs="10">
                                <xs:complexType>
                                  <xs:sequence>
                                    <xs:element name="candname" minOccurs="1" maxOccurs="1" type="xs:string"/>
                                    <xs:element name="candparty" minOccurs="1" maxOccurs="1" type="xs:string"/>
                                  </xs:sequence>
                                </xs:complexType>
                              </xs:element>
                            </xs:sequence>
                          </xs:complexType>
                        </xs:element>
                      </xs:sequence>
                    </xs:complexType>
                  </xs:element>
                </xs:sequence>
              </xs:complexType>
            </xs:element>
            <xs:element name="propositions">
              <xs:complexType>
                <xs:sequence>
                  <xs:element name="proposition" minOccurs="1" maxOccurs="unbounded">
                    <xs:complexType>
                      <xs:sequence>
                        <xs:element name="ptitle" minOccurs="1" maxOccurs="1" type="xs:string"/>
                        <xs:element name="pdesc" minOccurs="1" maxOccurs="1" type="xs:string"/>
                      </xs:sequence>
                    </xs:complexType>
                  </xs:element>
                </xs:sequence>
              </xs:complexType>
            </xs:element>
          </xs:sequence>
        </xs:complexType>
      </xs:element>
    </xs:schema>
    

    It validates the following sample XML:

    <?xml version="1.0" encoding="utf-8"?>
    <ballot>
      <races>
        <race>
          <rtitle>rtitle1</rtitle>
          <candidates>
            <candidate>
              <candname>candname1</candname>
              <candparty>candparty1</candparty>
            </candidate>
            <candidate>
              <candname>candname2</candname>
              <candparty>candparty2</candparty>
            </candidate>
          </candidates>
        </race>
        <race>
          <rtitle>rtitle2</rtitle>
          <candidates>
            <candidate>
              <candname>candname4</candname>
              <candparty>candparty4</candparty>
            </candidate>
          </candidates>
        </race>
      </races>
      <propositions>
        <proposition>
          <ptitle>ptitle1</ptitle>
          <pdesc>pdesc1</pdesc>
        </proposition>
        <proposition>
          <ptitle>ptitle2</ptitle>
          <pdesc>pdesc2</pdesc>
        </proposition>
        <proposition>
          <ptitle>ptitle3</ptitle>
          <pdesc>pdesc3</pdesc>
        </proposition>
      </propositions>
    </ballot>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.