Declarations : all « XML Schema « XML Tutorial

Home
XML Tutorial
1.Introduction
2.Namespace
3.XML Schema
4.XPath
5.XSLT stylesheet
XML Tutorial » XML Schema » all 
3.61.2. Declarations
<all> says that the elements within your content model may appear in any order.
<all> must be the only content model declaration that appears as a child of a <complexType> definition. 
<all> cannot contain <sequence>, <choice>, or <group> declarations. 
<all> declaration's children may appear once each in the instance document. 
Within the <all>, the values for minOccurs/maxOccurs are limited to or 1. 
<all> is used when the expected content is known, but not the order. 

Suppose you declared the <name> content model using the <all>: 

<element name="name"
    <complexType>
        <all>
            <element name="first" type="string"/
            <element name="middle" type="string"/
            <element name="last" type="string"/
        </all>
        <attribute name="title" type="string"/
    </complexType>
</element>


The allowable content for a <name> element declared using an <all> declaration might include 

<name>
    <first>first</first> 
    <middle>middle</middle> 
    <last>last</last> 
</name>
or 

<name>
    <first>first</first> 
    <last>last</last> 
    <middle>middle</middle> 
</name>
3.61.all
3.61.1.Allowing Elements to Appear in Any Order
3.61.2. Declarations
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.