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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T10:11:11+00:00 2026-05-19T10:11:11+00:00

is it possible to create a schema where the children of an element would

  • 0

is it possible to create a schema where the children of an element would be partialy in a sequence and partiali not? something like this:

<xs:element name="rootElement">
 <xs:complexType>
  <xs:all>
   <xs:element name="value1" type="xs:string"/>
   <xs:element name="value2" type="xs:string"/>
  </xs:all>
  <xs:sequence>
   <xs:element name="value3" type="xs:string"/>
   <xs:element name="value4" type="xs:string"/>
  </xs:sequence>
 </xs:complexType>
</xs:element>

Thanks in advance!

  • 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-19T10:11:12+00:00Added an answer on May 19, 2026 at 10:11 am

    OK. I think I understand you know. Your XML looks like:

    <?xml version="1.0"?>
    <house> 
        <ownerName>aaa</ownerName>
        <ownerLastName>bbb</ownerLastName>
        <rooms>
            <room1>kitchen</room1>
            <room2>living room</room2>
            <room3></room3>
            <room4></room4> 
            <room5></room5>
        </rooms>
    </house>
    

    You want the ownerName and ownerLastName elements to occur in any order although they must both be present. It’s not clear from your description it the position of the rooms element is important. I have assumed it is. It’s import that the child elements of rooms remain in order.

    Splitting this up, we can define a complexType for rooms (so the model is complete)

    <xs:complexType name="RoomType">
        <xs:simpleContent>
            <xs:extension base="xs:string"/>
        </xs:simpleContent>
    </xs:complexType>
    
    <xs:element name="RoomsType">
        <xs:complexType>
            <xs:sequence>
                <xs:element name="room1" type="RoomType"/>
                <xs:element name="room2" type="RoomType"/>
                <xs:element name="room3" type="RoomType"/>
                <xs:element name="room4" type="RoomType"/>
                <xs:element name="room5" type="RoomType"/>
            </xs:sequence>
        </xs:complexType>
    </xs:element>
    

    This gives us the sequence of rooms in order.

    There are quite a few limitations on the use of xs:all so I’ve avoided it here (you can’t use in a sequence, for example). In order to allow the owner names to occur in any order, I’ve used a choice of two sequences. The choice is embedded in another sequence to ensure that the rooms element comes last.

    <xs:complexType name="HouseType">
        <xs:sequence>
            <xs:choice>
                <xs:sequence>
                    <xs:element ref="ownerName"/>
                    <xs:element ref="ownerLastName"/>
                </xs:sequence>
                <xs:sequence>
                    <xs:element ref="ownerLastName"/>
                    <xs:element ref="ownerName"/>
                </xs:sequence>
            </xs:choice>
            <xs:element name="rooms" type="HouseType"/>
        </xs:sequence>
    </xs:complexType>
    
    <xs:element name="house" type="HouseType"/>
    

    Now, if you actually don’t care about the order or ownerLastName, ownerName and house then you can use xs:all without a problem:

    <xs:complexType name="HouseType">
        <xs:all>
            <xs:element ref="ownerName"/>
            <xs:element ref="ownerLastName"/>
            <xs:element name="rooms" type="HouseType"/>
        </xs:all>
    </xs:complexType>
    

    which requires that you have all three elements present in any order.

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

Sidebar

Related Questions

I'd like to create schema automatically, if not exists. Currently I use this code
Possible Duplicate: Create event handler for OnScroll for web browser control I would like
Given an XML layout like this, I'm trying to create a XSD schema to
I'm going to create a schema like this: [ { username: fabio, password: xxx,
don't know if this is possible.. I'm using sqlite3 schema: CREATE TABLE docs (id
Is it possible to implement something like the following trigger CREATE TRIGGER [tr_AU_ddl_All_Server] ON
Hi it'd like to know if it's at all possible create a parametric equalizer
Schema: CREATE TABLE IF NOT EXISTS `tx_hep_homes_attributes_mm` ( `uid_local` int(11) NOT NULL DEFAULT '0',
I want to know if it's possible to create MySQL Schema from database diagram
Is it possible to create, not just a table with EF CodeFirst, but also

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.