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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T05:43:53+00:00 2026-05-11T05:43:53+00:00

If I have an element with one or more subelements, should the min/maxoccurs attributes

  • 0

If I have an element with one or more subelements, should the min/maxoccurs attributes be on the xsd:sequence element, the xsd:element, both, or neither?

<xsd:element name='books'>   <xsd:complexType>     <xsd:sequence minOccurs='1' maxOccurs='unbounded'> <!-- here? -->       <xsd:element ref='book' minOccurs='1' maxOccurs='unbounded'/> <!-- or here? -->     </xsd:sequence>   </xsd:complexType> </xsd:element> 
  • 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. 2026-05-11T05:43:54+00:00Added an answer on May 11, 2026 at 5:43 am

    In almost all circumstances, you want to put the min/max Occurs on the element within a sequence and not on the sequence. Using your example:

    <xsd:element name='books'>   <xsd:complexType>     <xsd:sequence>       <xsd:element ref='book' minOccurs='1' maxOccurs='unbounded'/>     </xsd:sequence>   </xsd:complexType> </xsd:element> 

    This is unequivocal. If you have a series of book elements in a row, you can point to exactly which schema item is producing them. However:

    <xsd:element name='books'>   <xsd:complexType>     <xsd:sequence minOccurs='1' maxOccurs='unbounded'/>       <xsd:element ref='book' minOccurs='1' maxOccurs='unbounded'/>     </xsd:sequence>   </xsd:complexType> </xsd:element> 

    Here, if you have two ‘book‘ elements in a row, do you have two sequences in a row, or one sequence with two book elements? This fails the Unique Particle Attribution requirement.

    Finally, if you put the min/max Occurs on the sequence and you later add an additional element:

    <xsd:element name='books'>   <xsd:complexType>     <xsd:sequence minOccurs='1' maxOccurs='unbounded'/>       <xsd:element ref='book'/>       <xsd:element ref='ebook'/>     </xsd:sequence>   </xsd:complexType> </xsd:element> 

    then this may allow the following XML, which is probably not what you intend:

    <books>   <book/><ebook/><book/><ebook/><book/><ebook/><book/><ebook/> </books> 

    whereas if you have:

    <xsd:element name='books'>   <xsd:complexType>     <xsd:sequence/>       <xsd:element ref='book' minOccurs='1' maxOccurs='unbounded'/>       <xsd:element ref='ebook' minOccurs='1' maxOccurs='unbounded'/>     </xsd:sequence>   </xsd:complexType> </xsd:element> 

    then it is clear and unambiguous what you intend: A sequence of one or more book elements followed by a sequence of one or more ebook elements.

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

Sidebar

Related Questions

I have an List with one element in it, but which may have more
Because list have one more pointer(previous pointer) than forward_list, so if they both hold
I have one function for one element: <a href=javascript:void(0); onclick=dothis()>Link</a> When this function is
I have to update one element on page with Ajax, do I have to
I have an XML variable with only one element in it. I need to
I have this function that switches the HTML contents from one element on a
I have to search through a list and replace all occurrences of one element
how i can duplicate one element from array: for example, i have this array:
I have a WCF service that is returning a block of xml. One element
I have a select element. <select class='cSelectType'> <option value=1>one</option> <option value=2>two</option> <option value=3>three</option> <option

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.