Home arrow XML arrow Page 3 - Designing Your Own XML Schema: Indicators

Designing Your Own XML Schema: Indicators

This is the fourth (and last) in this series of articles, which guides you in designing XML Schemas right from the basics without any hurdles. This part explains what indicators are and how to use them.

Author Info:
By: Jagadish Chaterjee
Rating: 5 stars5 stars5 stars5 stars5 stars / 9
March 27, 2006
  1. · Designing Your Own XML Schema: Indicators
  2. · The Choice indicator in XML Schema
  3. · The Sequence indicator in XML Schema
  4. · The maxOccurs and minOccurs indicators in XML Schema
  5. · Groups in XML Schema
  6. · Attribute Groups in XML Schema

print this article

Designing Your Own XML Schema: Indicators - The Sequence indicator in XML Schema
(Page 3 of 6 )

Another indicator from the XML Schema vocabulary is the “Sequence” indicator.  We have been using this indicator right from the beginning of this series, but I never explained it completely. It is specially used to inform that all the elements under it should occur in the same order.  None of the child elements could occur in a different order.

Let us consider the following schema:

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
 elementFormDefault="qualified" attributeFormDefault=
  <xs:element name="Employees">
              <xs:documentation>Contains All Employee
                    <xs:element name="Employee"
                                      <xs:element name="ID"
 type="xs:string" />
                                      <xs:element name="Name"
 type="xs:string" />
                                      <xs:element name="Age"
 type="xs:integer" />
        <xs:key name="PK_Employee_ID">
              <xs:selector xpath=".//Employee" />
              <xs:field xpath="ID" />

There exists nothing really important about the above schema.  The only issue would be that the “Employee” element should be supported with “ID,” ”Name” and “Age” in the same order.  For example, the following XML document would be invalid:

<?xml version="1.0" encoding="UTF-8"?>
<Employees xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 xsi:noNamespaceSchemaLocation="C:\Documents and
            <Age>27</ Age >
            <Age>27</ Age >

Within the above XML, even though the initial “Employee” information is quite correct, the rest of the “Employee” details do not match with the order we specified in the above schema.  Thus, the whole XML document becomes invalid!

blog comments powered by Disqus

- Open XML Finally Supported by MS Office
- XML Features Added to Two Systems
- Using Regions with XSL Formatting Objects
- Using XSL Formatting Objects
- More Schematron Features
- Schematron Patterns and Validation
- Using Schematron
- Datatypes and More in RELAX NG
- Providing Options in RELAX NG
- An Introduction to RELAX NG
- Path, Predicates, and XQuery
- Using Predicates with XQuery
- Navigating Input Documents Using Paths
- XML Basics
- Introduction to XPath

Watch our Tech Videos 
Dev Articles Forums 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us 
Weekly Newsletter
Developer Updates  
Free Website Content 
Contact Us 
Site Map 
Privacy Policy 

Developer Shed Affiliates


© 2003-2019 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap
Popular Web Development Topics
All Web Development Tutorials