Home > Store

XML Schema Complete Reference, The

Register your product to gain access to bonus material or receive a coupon.

XML Schema Complete Reference, The


  • Sorry, this book is no longer in print.
Not for Sale



  • Extensive examples for Java, C++, SQL, VB, Web services, and both Oracle and Microsoft databases.
  • Authoritative - authors are on W3C working groups.


  • Copyright 2003
  • Edition: 1st
  • Book
  • ISBN-10: 0-672-32374-5
  • ISBN-13: 978-0-672-32374-4

With the successful implementation of XML Schema, developers are learning how to increase productivity, improve software reliability, minimize development time, and decrease time to market. This in-depth reference is an all-in-one resource designed to help developers leverage the power and potential of XML schemas by offering a complete roadmap to their creation, design, and use.

This authoritative reference and tutorial is filled with practical insights and detailed examples. The book begins by providing a conceptual introduction to XML Schema. From there, coverage shifts to the W3C Schema Recommendation and how to apply schemas to specific business goals. The authors provide insight and instruction throughout on integrating XML schemas into existing technologies such as .NET, Java, Visual Basic, Oracle, and more. The book concludes with a complete case study designed to reinforce and illustrate material covered.

Additional topics include:

  • Applications for schemas
  • Simple and complex types
  • XML schema processing and validation
  • Namespaces in XML
  • Using schemas with DOM and SAX
  • XML schema document syntax
  • XML Information Sets
  • XML Schema applications of XPath

Whether designing a schema from scratch or integrating schemas into contemporary technologies, The XML Schema Complete Reference is the most complete and definitive sourcebook available for the XML Schema environment.


Sample Content

Online Sample Chapters

Java and the Apache XML Project

MSXML and the Schema Object Model (SOM)

XML Schema: XPath and Xpointer

Downloadable Sample Chapter

Click below for Sample Chapter(s) related to this title:
Sample Chapter 4

Table of Contents




1. Introduction.

Why XML?

Why XML Schemas?

What Is an XML Schema Document?

Benefits of an XML Schema.

Drawbacks of an XML Schema.

The World Wide Web Consortium (W3C) Recommendations.

The XML Recommendation.

The Namespace Recommendation.

The Infoset Recommendation.

The XPath Recommendation.

The Schema Recommendation.

Object-oriented Concepts.

Unifying Terminology.

Important Terminology Used in This Book.

Schema Values.

Parallel Concepts and Ignoring Differences.

Element Terminology.

Element Type Terminology.

Other Terminology to Expect in This Book.

Thematic Examples.

Thematic Example Quality.

Creating an XML Schema Document.

Editing an XML Schema Document.

Validating an XML Instance.

Typesetting Conventions.

Online Resources.

2. XML Processing.


Entity Managers.

Parsers and Lexical Analyzers.


Parsing Events, Information Sets, and Applications.

XML Structure Before and After Parsing.

XML Documents.

The XML Information Set.

The DOM.

Schema Processing.

Processing an XML Schema Document.

What Does a Schema Processor Add? The PSVI.

3. XML Namespaces.

Uniform Resource Names and Uniform Resource Locators.

Creating URIs.

Using RDDL with Namespace URLs.

Namespace Components.

Declaring Namespaces.

Qualified Names and QNames.

Qualified Names as Values.

Namespace Scoping.

XML Schema and Namespaces.

4. XPath and XPointer.


XPath Location Paths.


Node IDs.

Using XPath with Identity Constraints.


Location Sets.


Subelement Sequences.

XPointer Extensions to XPath.

Using XPointer and XPath to Locate Schemas.

5. The Structure of Documents and Schemas.

XML Documents.

The XML Information Set.

The Document Information Item Class.

The Element Information Item Class.

The Attribute Information Item Class.

The Character Information Item Class.

XML Information Set Summary.

Introduction to the PSVI.

Introduction to Schemas.

Schema Documents.


6. Overview of an XML Schema Document.

The Enclosing Schema Element.


The Default Namespace.

The Target Namespace.

Namespaces and the XML Instance.


Global Components.

Local and Anonymous Components.

Annotating Elements.

Constraining Elements.

Simple Content.

Constraining Attributes.

Simple Attribute Values.

Named Attribute-use Groups.

Attribute Wildcards.

Simple Types.

Built-in Datatypes.

Deriving Simple Types by Restriction.

Constraining Facets.



Complex Types.

Simple Content.

Complex Content.

Deriving Complex Types by Extension.

Deriving Complex Types by Restriction.

Blocking Complex Types.

Model Groups.

The All Model Group.

The Choice Model Group.

The Sequence Model Group.

The Named Model Group.

Substitution Groups.


Identity Constraint Definitions.


Imports and Includes.

Locating XML Schemas and XML Schema Components.

Schema Element IDs.

7. Creating an XML Schema Document.

A Simple XML Schema Document Example.

A Schema Element with Every Attribute.

Concepts and Observations.

Attributes of a Schema Element.

Content Options for a Schema Element.

The Annotation Element.

Attributes of an annotation Element.

Content Options for an Annotation Element.

The Appinfo Element.

Attributes of an Appinfo Element.

Content Options for an Appinfo Element.

The documentation Element.

Attributes of a Documentation Element.

Content Options for a Documentation Element.

The Include Element.

Attributes of an Include Element.

Content Options for an Include Element.

The Import Element.

Attributes of an Import Element.

Content Options for an Import Element.

The Notation Element.

Attributes of a Notation Element.

Content Options for a Notation Element.

The Redefine Element.

Attributes of a Redefine Element.

Content Options for a Redefine Element.

8. Element Types.

An Example of a Trivial Element Type.

Concepts and Observations.

Global and Local Element Types.

Substitution Groups.

Blocking Substitution.

Element Type Instantiability.

Nillable Element Types.

Element Types and Namespaces.

The Element Element.

Attributes of an Element Element.

Content Options for an Element Element.

The any Element.

Attributes of an any Element.

Content Options for an AnyAttribute Element.

9. Attribute Types.

An Example of an Attribute Type.

An Example of a Named Attribute-use Group.

An Example of AnyAttribute.

Concepts and Observations Regarding Attribute Types.

When to Use an Attribute Type.

Global and Local Attribute Types.

Namespaces and Attribute Types.

The Attribute Element.

Attributes of an Attribute Element.

Content Options for an Attribute Element.

The AttributeGroup Element.

Attributes of an AttributeGroup Element.

Content Options for an AttributeGroup Element.

The AnyAttribute Element.

Attributes of an AnyAttribute Element.

Content Options for an AnyAttribute Element.

10. Simple Types.

An Example of a Simple Type Derived from the Built-In Token Datatype.

An Example of a Pattern-Constrained Simple Type.

An Example of a Simple Type Derived from a User-derived Simple Type.

Concepts and Observations.

Constraining Facets.

The Value Space.

The Lexical Space.

The Canonical Lexical Representation.

Non-Instantiable Simple Types.

Global, Local, and Anonymous Simple Types.


The SimpleType Element.

Attributes of a SimpleType Element.

Constraining Facets of a SimpleType Element.

The Restriction Element.

Attributes of a Restriction Element.

Content Options for a Restriction Element.

Constraining Facets of a Restriction Element.

The List Element.

Attributes of a List Element.

Content Options for a List Element.

Constraining Facets of a List Element.

The Union Element.

Attributes of a Union Element.

Content Options for a Union Element.

Constraining Facets of a Union Element.

11. Complex Types.

An Example of a Complex Type Specifying Empty Content.

An Example of a Complex Type That Adds Attributes to a Simple Type.

An Example of a Complex Type Specifying Nested Element Types.

An Example of a Complex Type Specifying Mixed Content.

Concepts and Observations.

Explicitly Non-Instantiable Complex Types.

Implicitly Non-Instantiable Complex Types.

Adding Element Types or Attribute Types to a Derived Complex Type.

Removing Element Types or Attribute Types from a Derived Complex Type.

Prohibiting Extension or Restriction of a Complex Type.

Shorthand Notation of a Complex Type.

The ComplexType Element.

Attributes of a ComplexType Element.

Content Options for a ComplexType Element.

The SimpleContent Element.

Attributes of a SimpleContent Element.

Content Options for a SimpleContent Element.

The ComplexContent Element.

Attributes of a ComplexContent Element.

Content Options for a ComplexContent Element.

The Extension Element.

Attributes of an Extension Element.

Content Options for an Extension Element.

The Restriction Element.

Attributes of a Restriction Element.

Content Options for a Restriction Element.

The All Element.

Attributes of an All Element.

Content Options for an All Element.

The Choice Element.

Attributes of a Choice Element.

Content Options for a Choice Element.

The Sequence Element.

Attributes of a Sequence Element.

Content Options for a Sequence Element.

The Group Element.

Attributes of a Group Element.

Content Options for a Group Element.

12. Built-In Datatypes.

Numeric Datatypes.

The Built-In decimal Datatype.

The Built-In Floating-Point Datatypes: Float and Double.

The Built-in Infinite Integer Datatypes: Integer, Positiveintegeer, Negativeinteger, Nonpositiveinteger, Annonnegativeinteger.

The Built-in Finite Integer Datatypes: Long, Int, Short, Byte, Unsignedlonng, Unsignedint, Unsignedshortand Unsignedbyte.

Date, Time, and Duration Datatypes.

The Built-In Time-Line-based Datatypes: Datetime, Date, gYearMontth, and gYear.

The Built-In Duration Datatype.

The Built-In Repeating Dates and Times Datatypes: Time, gMonthDaay, gDay, and gMonth.

String Datatypes.

The Built-In String Datatype.

Ordinary String-Derived Datatypes: Normalizedstring, Token, Languagge, NMTOKEN, NMTOKENS, Name, anNCName.

“Magic” String-Derived Datatypes: IID, IDREF, IDREFS, ENTITY, and ENTITIES.

Oddball Datatypes.

The Built-In QName Datatype.

The Built-In Boolean Datatype.

The Built-In Hexbinary and Base64binary Datatypes.

The Built-in AnyURI Datatype.

The Built-In Notation Datatype.

13. Identity Constraints.

Identity Constraint Example.

Concepts and Observations.

Identity Constraint Terminology.

Selectors and Fields.

Limited XPath Support.

Value Equality.

Enforcing Uniqueness.

Enforcing Referential Integrity.

The Unique Element.

The Attributes of a Unique Element.

Content Options for a Unique Element.

The Key Element.

The Attributes of a Key Element.

Content Options for a Key Element.

The Keyref Element.

The Attributes of a Keyref Element.

Content Options for a Keyref Element.

The Selector Element.

The Attributes of a Selector Element.

Content Options for a Selector Element.

The Field Element.

The Attributes of a Field Element.

Content Options for a Field Element.

14. Regular Expressions.

Concepts and Observations.

Unicode Regular Expression Guidelines.

The Latin Character Set.

Perl Regular Expressions.

XML Schemas.

Regular Expression Syntax.





Individual Characters.

Cardinality Quantifiers.

Character Classes Expressions.


Constraining Simple Content.

The Pattern Constraining Facet.

Multiple Pattern Constraining Facets (or).

Constraining Derived Types (and).


15. XML Schema Component Detail.

Schemas: The Basic Idea.



Schema (Schema Schema Component).

Attribute Types.

Attribute Type (Attribute Declaration Schema Component).

Simple Type (Simple Type Definition Schema Component).

Constraining Facets.

Element Types.

Element Type (Element Declaration Schema Component).

Complex Type (Complex Type Definition Schema Component).

Attribute Set Models.

Content Models.

Simple Type (Simple Type Definition Schema Component) Reprise.


Annotation (Annotation Schema Component).

Notation (Notation Declaration Schema Component).

16. PSVI Detail.

Schema Validation and Schema Processing.

Kinds of Validation.

The Results of Validation.


The Basic Infoset.

PSVI-Added Properties.

PSVI-Added Information Items.

The New PSVI Information Items.

17. Java and the Apache XML Project.

Apache Background.

Java Xerces on Your Computer.

Downloading Java Xerces 2 Parser.

Exploring the Xerces Package.

Running the Samples.

“Hello Apache”.

Your First Parser.

Parsing “Hello Apache”.

Critical Xerces Packages.

Xerces Java DOM In-Depth.

The Document Interface.

Creating DOM Documents.

The Element Interface.

The Node Interface.

An Advanced DOM Example.

DOM Helpers and DOM Level 3.

Java Xerces SAX In-Depth.

The ContentHandler Interface.

18. MSXML and the Schema Object Model (SOM).

Introducing MSXML.

Concepts and Observations.

…MS Stands for Microsoft.

Proprietary Versus Standard.

XML Schema Examples.

MSXML Fundamentals.

Using MSXML from Visual Basic.

Using the DOM.

Using SAX2.

Schema Object Model (SOM).

SOM Fundamentals.

The ISchemaItem Interface.

The ISchema Interface.

DOM Versus SOM.

Creating XML Schemas.


XML Document Samples.

Validation by Using the DOM.

Validation by Using SAX2.

Example: XML Schema Tree.


19. Object-Oriented Schemas.

Concepts and Observations.

Fundamentals of Object-Oriented Development.

Use of Languages.

Object-Oriented Concepts.




XML Schemas and Objects.

The Good.

The Bad.

The Answer.

Mapping XML Schemas to Object-Oriented Languages.

Complex Types.

Element Types.



Simple Types.


Putting It Together.

Sample Schema: Party.xsd.

Design Patterns.

Builder Pattern and XML Schemas.

Language Examples.

Visual Basic.


C# and the .NET Framework.

20. Document-Oriented Schemas.

Why Use XML for Documents?

Creating a Schema for a Set of Documents: Document Analysis.

Scenario: A Document Analysis.

Structures to Look For.

More Detail.

Implementing Document Processing.

Help for the Author.

Help for the Editor.

Automating Production.

21. Application-Oriented Schemas.

XML Applications.

Fundamentals of XML Applications.

XML Input and Output.

Transport Protocol.

Business Logic.

Role of XML Schemas.

Validation of Data.

Describing Arguments.

Describing Applications.

Application Structure.




Transporting XML.

Transport Protocols.



Describing Applications.

Using XML Schemas. 0672323745T09112002


The authoring and editorial teams for this book have worked hard to bring you the cleanest, clearest, and most complete XML schema reference source on the market. Endless sweat, research hours, code testing, tech and definition reviews and counter explanations, e-mail queries, dialogue, and debates passed before this book came to fruition. Earnest efforts, stress-filled moments, and writing deadlines have finally gotten us to press time. Here is what this book means to us.

The History

There are always new and hot technologies to write about (C++, Java, SQL, .NET, XML schema, and much more). There are qualified writers eager to write a clear and concise bestseller for your bookshelf. There are millions of software developers eager to learn. There are more than a few publishers to choose from. Ultimately there are several technical books on the market within months of any new product, platform, service, tool, or language's release that seeks to describe, explain, clarify, and elaborate on a given technology's importance, utility, and implementation. However, there are very few really good books on the "why and when" that will actually teach developers emerging technologies. In fact, the hardest types of books to write discuss emerging technologies, because there really aren't many good examples. Furthermore, even the "experts" frequently disagree on what is "right."

We spent many months--full time--writing this book. Collectively, we have something like 80 years of experience. Some of us are on the W3C Schema Working Group. We believe that this combined experience, as well as the determination writing this book, results in one of the few "really good books" previously mentioned. It takes the right combination of technology, authors, publishers, and readers to pull off a book.

The Book

There are several, and probably soon to be lots, of books on the market that pertain to XML schemas. Despite this influx, we strongly believe that this book provides details few, if any, other books provide. Specifically, the overarching goal driving this book is to provide detailed examples of every XML schema component. In order to detail each component, this book contains an example of the corresponding schema document element, and all of the associated attributes. Many of the books on the market today provide surface details about schema components. However, this book provides detailed scenarios. Not only are there many pages and examples of each schema element, there is at least one example of every single attribute of every single XML schema document element. Having accomplished that colossal task, we added example after example integrating with many languages and technologies on many platforms. After all, what good is an XML schema by itself?

The Web Site

The http://www.XMLSchemaReference.com Web site corresponds directly to this book. The sole purpose of this Web site is to provide an online reference for developers writing XML schemas. Nominally, the Web site provides a place to download all of the files created while writing this book. These files include not only the XML schemas and the source code in various languages, but also all of the test cases for even the one-line code snippets: all of the code in this book is tested!

The Web site is much more extensive than just a collection of files, however. In addition to the traditionally available downloads, http://www.XMLSchemaReference.com has lots simple online examples of every schema document element. There are tables for each element that indicate what attributes are possible, as well as a brief description. Although this Web site is not a tutorial, it is a fantastic quick reference for those who already understand schemas in general, but might forget the specific syntax. It is our hope that the Web site, like the book, becomes real reference material for lots of developers.

The Value

Our goal is to make it easy to create an XML schema--whether you need a tutorial to write your first schema document, or you just need a reference book to write your 5,000th. Having created a schema, this book also gives you the same levels of assistance to incorporate an XML schema into your application. This book provides as much support as you need, without ever getting in the way. Have fun working with XML schemas--we do!

We invite you now to take a tour through the world of XML schema components, beginning with the introduction provided for you in Chapter 1. We welcome your stories, additions, code samples, questions, feedback, and insights.

Cliff Binstock
Dave Peterson
Mitch Smith
Mike Wooding
Chris Dix
Chris Galtenberg



Click below to download the Index file related to this title:


Submit Errata

More Information

InformIT Promotional Mailings & Special Offers

I would like to receive exclusive offers and hear about products from InformIT and its family of brands. I can unsubscribe at any time.


Pearson Education, Inc., 221 River Street, Hoboken, New Jersey 07030, (Pearson) presents this site to provide information about products and services that can be purchased through this site.

This privacy notice provides an overview of our commitment to privacy and describes how we collect, protect, use and share personal information collected through this site. Please note that other Pearson websites and online products and services have their own separate privacy policies.

Collection and Use of Information

To conduct business and deliver products and services, Pearson collects and uses personal information in several ways in connection with this site, including:

Questions and Inquiries

For inquiries and questions, we collect the inquiry or question, together with name, contact details (email address, phone number and mailing address) and any other additional information voluntarily submitted to us through a Contact Us form or an email. We use this information to address the inquiry and respond to the question.

Online Store

For orders and purchases placed through our online store on this site, we collect order details, name, institution name and address (if applicable), email address, phone number, shipping and billing addresses, credit/debit card information, shipping options and any instructions. We use this information to complete transactions, fulfill orders, communicate with individuals placing orders or visiting the online store, and for related purposes.


Pearson may offer opportunities to provide feedback or participate in surveys, including surveys evaluating Pearson products, services or sites. Participation is voluntary. Pearson collects information requested in the survey questions and uses the information to evaluate, support, maintain and improve products, services or sites, develop new products and services, conduct educational research and for other purposes specified in the survey.

Contests and Drawings

Occasionally, we may sponsor a contest or drawing. Participation is optional. Pearson collects name, contact information and other information specified on the entry form for the contest or drawing to conduct the contest or drawing. Pearson may collect additional personal information from the winners of a contest or drawing in order to award the prize and for tax reporting purposes, as required by law.


If you have elected to receive email newsletters or promotional mailings and special offers but want to unsubscribe, simply email information@informit.com.

Service Announcements

On rare occasions it is necessary to send out a strictly service related announcement. For instance, if our service is temporarily suspended for maintenance we might send users an email. Generally, users may not opt-out of these communications, though they can deactivate their account information. However, these communications are not promotional in nature.

Customer Service

We communicate with users on a regular basis to provide requested services and in regard to issues relating to their account we reply via email or phone in accordance with the users' wishes when a user submits their information through our Contact Us form.

Other Collection and Use of Information

Application and System Logs

Pearson automatically collects log data to help ensure the delivery, availability and security of this site. Log data may include technical information about how a user or visitor connected to this site, such as browser type, type of computer/device, operating system, internet service provider and IP address. We use this information for support purposes and to monitor the health of the site, identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents and appropriately scale computing resources.

Web Analytics

Pearson may use third party web trend analytical services, including Google Analytics, to collect visitor information, such as IP addresses, browser types, referring pages, pages visited and time spent on a particular site. While these analytical services collect and report information on an anonymous basis, they may use cookies to gather web trend information. The information gathered may enable Pearson (but not the third party web trend services) to link information with application and system log data. Pearson uses this information for system administration and to identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents, appropriately scale computing resources and otherwise support and deliver this site and its services.

Cookies and Related Technologies

This site uses cookies and similar technologies to personalize content, measure traffic patterns, control security, track use and access of information on this site, and provide interest-based messages and advertising. Users can manage and block the use of cookies through their browser. Disabling or blocking certain cookies may limit the functionality of this site.

Do Not Track

This site currently does not respond to Do Not Track signals.


Pearson uses appropriate physical, administrative and technical security measures to protect personal information from unauthorized access, use and disclosure.


This site is not directed to children under the age of 13.


Pearson may send or direct marketing communications to users, provided that

  • Pearson will not use personal information collected or processed as a K-12 school service provider for the purpose of directed or targeted advertising.
  • Such marketing is consistent with applicable law and Pearson's legal obligations.
  • Pearson will not knowingly direct or send marketing communications to an individual who has expressed a preference not to receive marketing.
  • Where required by applicable law, express or implied consent to marketing exists and has not been withdrawn.

Pearson may provide personal information to a third party service provider on a restricted basis to provide marketing solely on behalf of Pearson or an affiliate or customer for whom Pearson is a service provider. Marketing preferences may be changed at any time.

Correcting/Updating Personal Information

If a user's personally identifiable information changes (such as your postal address or email address), we provide a way to correct or update that user's personal data provided to us. This can be done on the Account page. If a user no longer desires our service and desires to delete his or her account, please contact us at customer-service@informit.com and we will process the deletion of a user's account.


Users can always make an informed choice as to whether they should proceed with certain services offered by InformIT. If you choose to remove yourself from our mailing list(s) simply visit the following page and uncheck any communication you no longer want to receive: www.informit.com/u.aspx.

Sale of Personal Information

Pearson does not rent or sell personal information in exchange for any payment of money.

While Pearson does not sell personal information, as defined in Nevada law, Nevada residents may email a request for no sale of their personal information to NevadaDesignatedRequest@pearson.com.

Supplemental Privacy Statement for California Residents

California residents should read our Supplemental privacy statement for California residents in conjunction with this Privacy Notice. The Supplemental privacy statement for California residents explains Pearson's commitment to comply with California law and applies to personal information of California residents collected in connection with this site and the Services.

Sharing and Disclosure

Pearson may disclose personal information, as follows:

  • As required by law.
  • With the consent of the individual (or their parent, if the individual is a minor)
  • In response to a subpoena, court order or legal process, to the extent permitted or required by law
  • To protect the security and safety of individuals, data, assets and systems, consistent with applicable law
  • In connection the sale, joint venture or other transfer of some or all of its company or assets, subject to the provisions of this Privacy Notice
  • To investigate or address actual or suspected fraud or other illegal activities
  • To exercise its legal rights, including enforcement of the Terms of Use for this site or another contract
  • To affiliated Pearson companies and other companies and organizations who perform work for Pearson and are obligated to protect the privacy of personal information consistent with this Privacy Notice
  • To a school, organization, company or government agency, where Pearson collects or processes the personal information in a school setting or on behalf of such organization, company or government agency.


This web site contains links to other sites. Please be aware that we are not responsible for the privacy practices of such other sites. We encourage our users to be aware when they leave our site and to read the privacy statements of each and every web site that collects Personal Information. This privacy statement applies solely to information collected by this web site.

Requests and Contact

Please contact us about this Privacy Notice or if you have any requests or questions relating to the privacy of your personal information.

Changes to this Privacy Notice

We may revise this Privacy Notice through an updated posting. We will identify the effective date of the revision in the posting. Often, updates are made to provide greater clarity or to comply with changes in regulatory requirements. If the updates involve material changes to the collection, protection, use or disclosure of Personal Information, Pearson will provide notice of the change through a conspicuous notice on this site or other appropriate way. Continued use of the site after the effective date of a posted revision evidences acceptance. Please contact us if you have questions or concerns about the Privacy Notice or any objection to any revisions.

Last Update: November 17, 2020