If you need to create or use formal descriptions of XML vocabularies, the W3C's XML Schema offers a powerful set of tools for defining acceptable document structures and content. An alternative to DTDs as the way to describe and validate data in an XML environment, XML Schema enables developers to create precise descriptions with a richer set of datatypes?such as booleans, numbers, currencies, dates and times?that are essential for today?s applications.Schemas are powerful, but that power comes with substantial complexity. This concise book explains the ins and outs of XML Schema, including design choices, best practices, and limitations. Particularly valuable are discussions of how the type structures fit with existing database and object-oriented program contexts. With XML Schema, you can define acceptable content models and annotate those models with additional type information, making them more readily bound to programs and objects. Schemas combine the easy interchange of text-based XML with the more stringent requirements of data exchange, and make it easier to validate documents based on namespaces.You?ll find plenty of examples in this book that demonstrate the details necessary for precise vocabulary definitions. Topics include:
Foundations of XML Schema syntax
Flat, "russian-doll", and other schema approaches
Working with simple and complex types in a variety of contexts
The built-in datatypes provided by XML Schema
Using facets to extend datatypes, including regular expression-based patterns
Using keys and uniqueness rules to limit how and where information may appear
Creating extensible schemas and managing extensibility
Documenting schemas and extending XML Schema capabilities through annotations
In addition to the explanatory content, XML Schemaprovides a complete reference to all parts of both the XML Schema Structures and XML Schema Datatypes specifications, as well as a glossary. Appendices explore the relationships between XML Schema and other tools for describing document structures, including DTDs, RELAX NG, and Schematron, as well as work in progress at the W3C to more tightly integrate XML Schema with existing specifications.No matter how you intend to use XML Schema - for data structures or document structures, for standalone documents or part of SOAP transactions, for documentation, validation, or data binding ? all the foundations you need are outlined in XML Schema.
Chapter 1 Schema Uses and Development
What Schemas Do for XML
W3C XML Schema
Chapter 2 Our First Schema
The Instance Document
Our First Schema
Chapter 3 Giving Some Depth to Our First Schema
Working From the Structure of the Instance Document
Chapter 4 Using Predefined Simple Datatypes
Lexical and Value Spaces
Date and Time Datatypes
What About anySimpleType?
Back to Our Library
Chapter 5 Creating Simple Datatypes
Derivation By Restriction
Derivation By List
Derivation By Union
Some Oddities of Simple Types
Back to Our Library
Chapter 6 Using Regular Expressions to Specify Simple Datatypes
The Swiss Army Knife
The Simplest Possible Patterns
Back to Our Library
Chapter 7 Creating Complex Datatypes
Simple Versus Complex Types
Examining the Landscape
Simple Content Models
Complex Content Models
Mixed Content Models
Empty Content Models
Back to Our Library
Derivation or Groups
Chapter 8 Creating Building Blocks
Schema Inclusion with Redefinition
Simplifying the Library
Chapter 9 Defining Uniqueness, Keys, and Key References
xs:ID and xs:IDREF
XPath-Based Identity Checks
ID/IDREF Versus xs:key/xs:keyref
Using xs:key and xs:unique As Co-occurrence Constraints
Chapter 10 Controlling Namespaces
Namespaces Present Two Challenges to Schema Languages
To Qualify Or Not to Qualify?
Namespaces and XPath Expressions
Referencing Other Namespaces
Schemas for XML, XML Base and XLink
Namespace Behavior of Imported Components
Importing Schemas with No Namespaces
Allowing Any Elements or Attributes from a Particular Namespace
Chapter 11 Referencing Schemas and Schema Datatypes in XML Documents
Associating Schemas with Instance Documents
Defining Element Types
Defining Nil (Null) Values
Beware the Intrusive Nature of These Features...
Chapter 12 Creating More Building Blocks Using Object-Oriented Features
Eric van der Vlist is the resident expert on XML schema languages on XML.com. He is also a member of the ISO DSDL committee, where standardization work on RELAX NG and related specifications is in progress. Eric is also the author of O'Reilly's XML Schema.
Our look is the result of reader comments, our own experimentation, and feedback from distribution channels. Distinctive covers complement our distinctive approach to technical topics, breathing personality and life into potentially dry subjects. The animal on the cover of XML Schema is a Reeves's pheasant. Reeves's pheasants originated in north and central China. They are named after the man who first introduced the species in England to be bred for game. The species is one of the most popular types of pheasant to be held in captivity and can be found all over the world.Reeves's pheasants are black, white, and bronze in color. Male pheasants have white heads with black stripes across their eyes resembling masks, while females have gold heads with light brown masks. Most remarkable are the birds' tail feathers, which can reach six feet long. These long tail feathers have historically been used in ceremonies.Hens produce two or more clutches of 8 to 14 eggs per season. The eggs are olive brown or cream color, and hatch after 24 days. They have to be separated from other chicks, especially of different species, soon after birth, as they tend to be quite aggressive. Dominant male Reeves's pheasants are also quite aggressive and need to be separated when held in captivity. Darren Kelly was the production editor, Mary Brady was the copyeditor, and Tatiana Diaz was the proofreader for XML Schema. Mary Anne Weeks Mayo and Claire Cloutier provided quality control. Interior composition was done by Philip Dangler, Matt Hutchinson, and Emily Quill. Judy Hoer wrote the index.Hanna Dyer designed the cover of this book, based on a series design by Edie Freedman. The cover image is a 19th-century engraving from the Dover Pictorial Archive. Emma Colby produced the cover layout with QuarkXPress 4.1 using Adobe's ITC Garamond font.David Futato designed the interior layout. This book was converted to FrameMaker 5.5.6 with a format conversion tool created by Erik Ray, Jason McIntosh, Neil Walls, and Mike Sierra that uses Perl and XML technologies. The text font is Linotype Birka; the heading font is Adobe Myriad Condensed; and the code font is LucasFont's TheSans Mono Condensed. The illustrations that appear in the book were produced by Robert Romano and Jessamyn Read using Macromedia FreeHand 9 and Adobe Photoshop 6. The tip and warning icons were drawn by Christopher Bing. This colophon was written by Linley Dolby.
While I'm not an expert on XML schema, I've been developing reasonably complex schema for a little while now. Still, I found this book largely unusable due to confusing, incomplete examples and clumsy explanations. I found myself reading and rereading the same section on ID and Key application, I'm pretty sure there are typos and / or errors because it just didn't make sense. Perhaps this book is usable as a reference, but not as an educational tool.
Bottom Line No, I would not recommend this to a friend
As an experienced developer, I had a need to get into schemas deep and fast. I bought a series of books on schemas, and never managed to get more than simple schemas working.
With this book, it all changed. This book teaches you the complicated subject of schemas. It covers regular expressions with examples. It describes pitfalls you *will* run into, and your options how to deal with them. You'll find out why schemas can be so cranky and frustrating sometimes.
It's not a tutorial. There are some simple tutorial books you might try before this one, if you want to get used to writing the syntax and such. But those books won't stand up, when you really start controlling XML with schemas.
The book is complicated to read. The sentences are long and sometimes twisted. I've found they're often necessarily so. The author is careful with his words, and schemas aren't that easy.
Two caveats: The book sometimes tells you about snags in subtle ways that you might not notice, 'til you actually slam headlong into them. And there's the occasional issue in the errata, typical for a new book on so complicated a subject.
But to me, that's minor. The book covers a tough subject in detail, and it gives me information that helps me solve problems. That makes it the first book I reach for when I have problems with a schema.
Very good for references, poor for beginners. If you already have a working knowledge of XML schemas and want to go deeper, then this book is for you. Else try something with more problem solving examples.
Exhaustive, covers design and best-practices issues as well as syntax.
Explanation could be quite a bit more lucid in places, though; state diagrams/Venn diagrams could go a good way to supplement text.
Book also heavily uses code examples in a sort of show-don't-tell way, and it is in this context that the code examples errata really really trip you up. I've never had to check out Errata on O'Reilly online catalog just to understand the text, before.
This is definitely the book to learn XML Schema. XML Schema Syntax can be confusing at first, even to some experienced programmers. The author uses clear and concise language to explain everything about the subject. The same example is used throughout the book to give consistency and relevancy. Very good explanation of pattern restriction.