XML.com 
 Published on XML.com http://www.xml.com/pub/a/2000/11/29/schemas/dataref.html
See this if you're having trouble printing code examples

 

W3C XML Schema Datatypes Reference
By Rick Jelliffe
November 29, 2000

This quick reference helps you easily locate the definition of datatypes in the XML Schema specification. A "What You Need To Know" section gives a brief introduction to the way datatypes work.

Specification Map

What You Need To Know

Derivation and Facets

Usage of the string datatype

The string datatype should not be used for general text. Use a complex type instead, allowing mixed content and "wildcarding" it to allow elements from other namespaces. This kind of declaration will be more future-proof. It is impossible to extend an element declared to have simple content so that it can contain sub-elements. Here is a definition that may be more suitable:

<complexType name="kindToStrangersText"  mixed="true" >
  <annotation>
    <documentation xml:lang="en" >
    This is a type definition for generic text in XML. 
    For maintenance reasons, it is preferable to use
    something like this rather than the built-in datatype
    string, unless you have an absolute requirement to
    use a simple datatype.
    </documentation>
  </annotation>
  <group minOccurs="0" maxOccurs="unbounded" >
    <any namespace="##other" />
  </group>
  <attributeGroup ref="xml:specialAttrs"/>
  <anyAttribute namespace="##any" />
</complexType>

You will have to import the xml:lang and xml:space definitions too:

<import namespace="http://www.w3.org/XML/1998/namespace"
   schemaLocation="http://www.w3.org/2000/10/xml.xsd" />

And the schema element itself should probably have namespace declaration.

xmlns:xml="http://www.w3.org/XML/1998/namespace"

Limitations

There is no provision for

XML.com Copyright © 1998-2006 O'Reilly Media, Inc.