Schema

| Disclaimer |
| This package contains an implementation of the W3C XML Schema language. This implementation is experimental. The XML Schema language is still in working draft stage: you should not consider this implementation complete or correct. The limitations of this implementation are detailed below. Please read this document before using this package.
| Introduction |
| This package contains an implementation of a subset of the W3C XML Schema Language as specified in the 7 April 2000 Working Drafts for Structures and Datatypes. The parsers contained in this package are able to read and validate XML documents with the grammar specified in either DTD or XML Schema format. There is no functionality for accessing typed data. We are making this package available in order to get feedback on the features in the XML Schema language design and on representing an XML document's grammar as part of the document's DOM tree. We intend to update this package until it implements all of the functionality of the then current XML Schema Working Draft. If you are interested in a particular unimplemented feature, we welcome your feedback on the Xerces-J mailing list.
| Limitations |
| The XML Schema implementation in this package is a subset of the features defined in the 7 April 2000 XML Schema Working Drafts.
| Components Supported |
| Element declarations Model group definitions: group Model groups: all, choice, sequence Attribute declarations Attribute group definitions Simple type definitions Complex type definitions Wildcards: any Wildcards: anyAttribute
| Components NOT Supported |
| Identity constraints: unique, key, keyref Notation declaration Annotation (ignored)
| Features Supported |
| Type derivation Anonymous types Nested element declaration Separate symbol spaces for elements, types, groups, and attribute groups Equivalency classes Target namespace "xsi:schemaLocation" and "xsl:noNamespacesSchemaLocation" Include Import "xsi:type"
| Features NOT Supported |
| Constraints in Chapter 5 Nullable Block Abstract
| Datatypes Supported |
| Built-in simple types (primitive, derived) Simple type derivation (restriction, list) Regular expressions Binary (base64, hex) Constraining facets
| Datatypes NOT Supported |
| Date/time -- ISO8601 (work in progress)
| Other Limitations |
| The schema is specified by the xsi:schemaLocation or xsi:noNamespaceSchemaLocation attribute on the root element of the document. The xsi prefix must be bound to the Schema document instance namespace, as specified by the working draft specification. See the sample provided in the Usage section.
| Usage |
| In this release, schema validation has been integrated with the regular SAXParser and DOMParser classes. No special classes are required to parse documents that use a schema. Documents that use XML Schema grammars specify the location of the grammar using an xsi:schemaLocation attribute attached to the root / top-level element in the document. Here is an example with no target namspace:
    <document
      xmlns:xsi='http://www.w3.org/1999/XMLSchema-instance'
      xsi:noNamespaceSchemaLocation='document.xsd'>
    ...
    </document>
Here is an example with a target namespace. Note that it is an error to specify a different namespace than the target namespace defined in Schema.
    <document
      xmlns='NS'
      xmlns:xsi='http://www.w3.org/1999/XMLSchema-instance'
      xsi:schemaLocation='NS document.xsd'>
    ...
    </document>
Review the sample file, 'data/personal.xsd' for an example of an XML Schema grammar.