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

The Archive Base Latest Questions

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

How can I design my xsd to ignore the sequence of elements? <root> <a/>

  • 0

How can I design my xsd to ignore the sequence of elements?

<root> <a/> <b/> </root>

<root> <b/> <a/> </root>

I need to use extension for code generation reasons, so I tried the following using all:

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema targetNamespace="http://www.example.com/test"
           xmlns:xs="http://www.w3.org/2001/XMLSchema"
           xmlns:t="http://www.example.com/test" >

    <xs:complexType name="BaseType">
        <xs:all>
            <xs:element name="a" type="xs:string" />
        </xs:all>
    </xs:complexType>

    <xs:complexType name="ExtendedType">
        <xs:complexContent>
            <xs:extension base="t:BaseType">
                <xs:all> <!-- ERROR -->
                    <xs:element name="b" type="xs:string" />
                </xs:all>
            </xs:extension>
        </xs:complexContent>
    </xs:complexType>

    <xs:element name="root" type="t:ExtendedType"></xs:element>
</xs:schema>

This xsd is not valid though, the following error is reported at <!-- ERROR -->:

cos-all-limited.1.2: An all model group must appear in a particle with {min occurs} = {max occurs} = 1, and that particle must be part of a pair which constitutes the {content type} of a complex type definition.

Documentation of cos-all-limited.1.2 says:

1.2 the {term} property of a particle with {max occurs}=1 which is part of a pair which constitutes the {content type} of a complex type definition.

I don’t really understand this (neither xsd nor English native speaker 🙂 ).


Am I doing the wrong thing, am I doing the right thing wrong, or is there no way to achieve this?

  • 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:44:22+00:00Added an answer on May 14, 2026 at 7:44 am

    MAJOR EDIT Originally I missed the requirement that you need to use xsd:extension. Note that xsd:extension works as if there was xsd:sequence with contents of the base type followed by contents of the extended type. As XML Schema Primer puts it:

    When a complex type is derived by
    extension, its effective content model
    is the content model of the base type
    plus the content model specified in
    the type derivation. Furthermore, the
    two content models are treated as two
    children of a sequential group.

    Therefore, it seems that the only way to make this work is to have an empty base type and store the whole alternative in the extended type, or vice versa (everything in the base and an empty extension). Like this:

    <xsd:complexType name="ExtendedType">
       <xsd:complexContent>
          <xsd:extension base="BaseType">
             <xsd:choice>
                <xsd:sequence>
                   <xsd:element name="a" type="xsd:string"/>
                   <xsd:element name="b" type="xsd:string"/>
                </xsd:sequence>
                <xsd:sequence>
                   <xsd:element name="b" type="xsd:string"/>
                   <xsd:element name="a" type="xsd:string"/>
                </xsd:sequence>
             </xsd:choice>
          </xsd:extension>
       </xsd:complexContent>
    </xsd:complexType>
    
    <xsd:complexType name="BaseType"/>
    
    <xsd:element name="root" type="ExtendedType"/>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm looking to see if I can design a HtmlHelper extension method that will
I am making a custom module where users can upload design content. I need
Can we use whole page design jpg file as css-sprite without slicing?
What is a design pattern I can use for generating context-sensitive right click menus
Visual Studio 2010 now opens XSD files in design mode by default. I can't
One can design plugins in C using 2 techniques (AFAIK): Use dlopen() all the
I am not sure how I can design the following problem in CouchDB. I
I'm trying to figure out what's the best design I can go with for
I can not find how to implement a design in C++. In the language
Can anyone suggest what software or tools that the best to design icon and

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.