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 4038806
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T12:31:07+00:00 2026-05-20T12:31:07+00:00

I need to generate a XSD for a XML file we are gonna use

  • 0

I need to generate a XSD for a XML file we are gonna use between systems so we can validate if the data we get is valid.

The XML looks like this (but with more fields):

<Request>
<Request_ID>1000012295</Request_ID>
<Extra_Info>
  <Item>
    <Item_Number>0000000001</Item_Number>
    <ItemDescription>test- 2</ItemDescription>    
  </Item>
  <Item>
    <Item_Number>0000000002</Item_Number>
    <ItemDescription>test - 2</ItemDescription>
  </Item>
</Extra_Info>
</Request>

and my XSD is the following:

<?xml version="1.0" encoding="utf-16"?>
<xsd:schema attributeFormDefault="unqualified" elementFormDefault="qualified" version="1.0" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <xsd:element name="Request">
    <xsd:complexType>
      <xsd:sequence>
        <xsd:element name="Request_ID" type="xsd:int" />
        <xsd:element name="Extra_Info">
          <xsd:complexType>
            <xsd:sequence>
              <xsd:element name="Item">
                <xsd:complexType>
                  <xsd:sequence>
                    <xsd:element name="Item_Number" type="xsd:int" />
                    <xsd:element name="ItemDescription" type="xsd:string" />
                  </xsd:sequence>
                </xsd:complexType>
              </xsd:element>
            </xsd:sequence>
          </xsd:complexType>
        </xsd:element>
      </xsd:sequence>
    </xsd:complexType>
  </xsd:element>
</xsd:schema>

This schema works when I only have one Item node, but as soon as I have more than one I get the following error:

The element ‘Extra_Info’ has invalid child element ‘Item’.

why is it not working if it is specified as a sequence?

Thanks!

PS: I used This Online Validator for quick validation, but I also get the same error with XMLReader

  • 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-20T12:31:07+00:00Added an answer on May 20, 2026 at 12:31 pm

    By default min and max occurs for an element are set to 1 even when defined inside a sequence

    your Extra_Info element definition should be as follows:

    <xsd:element name="Extra_Info">
      <xsd:complexType>
        <xsd:sequence>
          <xsd:element name="Item" maxOccurs="unbounded">
            <xsd:complexType>
              <xsd:sequence>
                <xsd:element name="Item_Number" type="xsd:int" />
                <xsd:element name="ItemDescription" type="xsd:string" />
              </xsd:sequence>
            </xsd:complexType>
          </xsd:element>
        </xsd:sequence>
      </xsd:complexType>
    </xsd:element>
    

    Note: the unbounded attribute which states you can have 1 or more of these elements.

    To have any number of items you can add minOccurs=’0′ to the item element so it looks like this:

    <xsd:element name="Item" maxOccurs="unbounded" minOccurs="0">
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to generate an XML file in C#. I want to write the
Usually, when it comes to xml, I write an xsd scheme file and generate
I need help on how to validate Xml file simply? I googled and found
I need to generate a random integer between 1 and n (where n is
I need to generate some passwords, I want to avoid characters that can be
I have a very large XML file that I need to parse so I
I have an XSD file which contains the schema for my XML. The XSD
I use a DataGrid to show a xml file. The Grid's DataSource is a
I need to solve the following question which i can't get to work by
Since an XSD schema is a valid XML document itself, is there any main

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.