The W3C XML Schema Language





The W3C XML Schema Language

The W3C XML Schema Language (often misleadingly labeled simply "schemas") is a very powerful but very complex language. The primary feature of this language, relative to other schema languages, is data typing, especially for attribute values and simple element text. This language can state that a particular element or attribute contains an int, a date, a string, a double, a qualified name, a positive integer, and so on. Beyond the 42 simple types it defines, developers can extend the language with their own types such as money, phone number, color, and more.

Key features of this language include the following:

  • Validation of element and attribute structures by complex types

  • Validation of text content by simple data types

  • Derivation of new types

  • Validation of parent–child relationships

  • Support for both ordered and unordered structures

  • Namespace awareness

  • Keys and key references

  • Annotation of elements

The W3C XML Schema Language is most appropriate when:

  • Documents contain traditional programming constructs such as database records or objects, rather than narrative documents like essays and poems.

  • Data is strongly typed in ways that are not apparent from the XML markup alone.

  • You need to define your own data types.

  • You want to annotate elements with meta-information placed in the schema, rather than the instance document.

  • The decision of which schema to apply is made by someone other than the schema author.

The W3C XML Schema Language is least appropriate when:

  • Ease of schema development is a major concern.

  • Performance is critical.

  • Constraints are based on structures other than parent–child relationships.

There are times when the W3C XML Schema Language is the right tool, but these cases aren't nearly as common as many developers think. It is just one tool in the XML toolbox, and a rather specialized one at that. The W3C XML Schema Language is sort of like a Torx T-15 screwdriver—crucial for certain jobs but not nearly as broadly useful as Phillips or flathead screwdrivers. With that in mind, let's look at some of the other schema tools in the XML toolbox.


     Python   SQL   Java   php   Perl 
     game development   web development   internet   *nix   graphics   hardware 
     telecommunications   C++ 
     Flash   Active Directory   Windows