Microsoft HomeproductssearchsupportshopWrite Us   Microsoft Home
Magazine
 |  Community
 |  Workshop
 |  Tools & Samples
 |  Training
 |  Site Info

Workshop  |  XML (Extensible Markup Language)

group Element


Organizes content into a group to specify a sequence.

Syntax

<group
    maxoccurs="{1 | *}" 
    minoccurs="{0 | 1}" 
    order="{one | seq | many}" >

Attributes

maxoccurs
Maximum number of times the group can occur. The following values can be assigned to this attribute.
1 Occurs at most once.
* Unlimited number of occurrences.
minoccurs
Minimum number of times the group can occur. The following values can be assigned to this attribute.
0 Not required; the group is optional.
1 Must occur at least once.
order
Constraints on the sequence of elements (and other contained groups) within this group. The following values can be assigned to this attribute.
one Permits only one instance of each element contained in the group. (This corresponds to the '|' symbol in the DTD.)
seq Requires the elements in the group to appear in the specified sequence.
many Permits the elements in the group to appear (or not appear) in any order.

The "seq" setting is needed to specify valid sequences. For example, it can be used to specify when a particular sequence such as "x1,y1" or "x2,y2" is valid but no other possible combinations are valid. The "seq" value serves the same role as parentheses in a document type definition (DTD).

Element Information

Number of occurrences Unlimited
Parent elements ElementType
Child elements Attribute, Element
Requires closing tag Yes. XML Schema is an XML grammar and, like all XML grammars, all tags must have closing tags to satisfy the definition of well-formed.

Remarks

The order attribute takes the same values as the order attribute of the ElementType element.

The minOccurs and maxOccurs attributes have the default value "1". A group with neither attribute must appear once and only once in a content model.

Examples

The following example demonstrates the "one" setting:


<ElementType name='z' order="one">
<element type="x">
<element type="y">
</ElementType>

The following represents a legal instance of the schema:


<z>
  <x/> 
  <y></y> 
</z>

The following example demonstrates the "seq" setting:


<ElementType name="x" order="one">
  <group order="seq">
    <element type="x1">
    <element type="y1">
  </group>
  <group order="seq">
    <element type="x2">
    <element type="y2">
  </group>
</ElementType>

The following two examples represent legal instances of this schema:


<x>
   <x1/> 
   <y1/>
</x>

and: 

<x>
   <x2/>
   <y2/>
</x>

The following example demonstrates the "many" setting:


<ElementType name="x" content="eltOnly" order="many">
    <element type='q'>
    <element type='r'>
</ElementType>

The following five examples represent all legal instances for this schema:


<x> </x>

<x> <q> </x>

<x> <r> </x>

<x> <q> <r> </x>

<x> <r> <q> </x>

Does this content meet your programming needs? Write us!

Back to topBack to top

© 1998 Microsoft Corporation. All rights reserved. Terms of use.

 

Magazine Home
Ask Jane
DHTML Dude
Extreme XML
For Starters
More or Hess
Servin' It Up
Site Lights
Web Men Talking
Member Community Home
Benefits: Freebies & Discounts
Benefits: Promote Your Site
Benefits: Connect with Your Peers
Benefits at a Glance
Online Special-Interest Groups
Your Membership
SBN Stores
Join Now
Workshop Home
Essentials
Content & Component Delivery
Component Development
Data Access & Databases
Design
DHTML, HTML & CSS
Extensible Markup Language (XML)
Languages & Development Tools
Messaging & Collaboration
Networking, Protocols & Data Formats
Reusing Browser Technology
Security & Cryptography
Server Technologies
Streaming & Interactive Media
Web Content Management
Workshop Index
Tools & Samples Home
Tools
Samples, Headers, Libs
Images
Sounds
Style Sheets
Web Fonts
Training Home
SBN Live Seminars
SBN Live Chats
Courses
Peer Support
CD-ROM Training
Books & Training Kits
Certification
SBN Home
New to SBN?
What's New on SBN
Site Map
Site Search
Glossary
Write Us
About This Site