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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T00:17:57+00:00 2026-05-16T00:17:57+00:00

i wanna write an xml schema that can accept some elements that can occur

  • 0

i wanna write an xml schema that can accept some elements that can occur any number of times in any order. like following examples. it should satisfy all similar combination. lease help me and thanks in advance.

Example 1

<root>
    <node1> one   </node1>
    <node1> two   </node1>
    <node2> three </node2>
    <node1> four  </node1>
    <node2> five  </node2>
    <node2> six   </node2>
</root>

Example 2

<root>    
    <node1> one   </node1>
    <node2> two   </node2>
    <node1> three </node1>
    <node2> four  </node2>
    <node2> five  </node2>
    <node1> six   </node1>
    <node1> seven </node1>
</root>
  • 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-16T00:17:58+00:00Added an answer on May 16, 2026 at 12:17 am

    Something like this should work:

    <?xml version="1.0" encoding="utf-8"?>
    <xs:schema id="root" xmlns:xs="http://www.w3.org/2001/XMLSchema">
      <xs:element name="root">
        <xs:complexType>
          <xs:choice minOccurs="0" maxOccurs="unbounded">
            <xs:element name="node1" nillable="true">
              <xs:complexType>
                <xs:simpleContent>
                  <xs:extension base="xs:string">
                  </xs:extension>
                </xs:simpleContent>
              </xs:complexType>
            </xs:element>
            <xs:element name="node2" nillable="true">
              <xs:complexType>
                <xs:simpleContent>
                  <xs:extension base="xs:string">
                  </xs:extension>
                </xs:simpleContent>
              </xs:complexType>
            </xs:element>
          </xs:choice>
        </xs:complexType>
      </xs:element>
    </xs:schema>
    

    Basically, the <xs:choice> gives you the option to pick any one of the contained nodes, e.g. any one of <node1> or <node2>. See W3Schools’ article for more explanations about the various options.

    Since the <xs:choice> has attributes minOccurs="0" and maxOccurs="unbounded", you can repeat that “pick any of the contained nodes” scenario any number of times.

    In the end, you can pick any number of nodes, and each time, you can pick either node1 or node2 (or more, if you add more options to the <xs:choice>)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I wanna write a program that should perform some tasks automatically if someone logs
I wanna write a application with push email capablity. Can some one guide me
I wanna write a function like this function (str, find){} such that when I
I wanna to have the ability to write an XML file with XmlTextWriter or
I know that in Seam, we could write an xml file (if my jsf
i wanna write a C program that runs on a mobile phone. Just for
I have a XML input which is obtained dynamically.How can i write the style
I wanna creating canvas (scribble pad) where users can write something with a brush
I wanna use custom font file. For that below is my code XML file:
I wanna write some data to Excel in C# with COM, but I got

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.