http://xml.apache.org/http://www.apache.org/http://www.w3.org/

Home

Readme
Download
Repository
Installation

API Docs
Samples
Schema

Properties
Features
FAQs

Releases
Caveats
Feedback

Y2K Compliance

Disclaimer
 

This package contains an implementation of the W3C XML Schema language. This implementation is experimental. The XML Schema language is in candidate recommendation stage: it is still possible that some changes in the specification could occur. You should also not necessarily 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 24 October 2000 Candidate Recommendations 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 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 24 October 2000 XML Schema Candidate Recommendations.


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
  • import and include
  • Notation declaration
  • Annotation
  • Redefine
  • Identity constraints: unique, key, keyref (experimental)

Features Supported
 
  • Type derivation
  • Anonymous types
  • Nested element declaration
  • Separate symbol spaces for elements, types, groups, and attribute groups
  • Substitution Groups
  • Target namespace
  • "xsi:schemaLocation" and "xsi:noNamespaceSchemaLocation"
  • Include
  • Import
  • "xsi:type"

Features NOT Supported
 
  • Constraints in Chapter 5 and elsewhere in the specifications
  • Nullable
  • Block and final
  • Fixed and default values of elements

Datatypes Supported
 
  • Built-in simple types (primitive, derived)
  • Simple type derivation (restriction, list, union)
  • 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 candidate recommendation specification. See the sample provided in the Usage section.

When a schemaLocation attribute appears in an instance document, only the first targetNamespace URI/schema location pair will be considered (the remaining pairs will be ignored). Subsequent schemaLocation attributes will also be ignored. To validate an instance document against multiple schemas, it is necessary to use <include>, <import> or <redefine> element information items within one of the schema documents.

We also emphasize that support for schema ID constraints is highly experimental. Some of the limitations of this support are:

  • Very little error-checking has been performed.
  • Identity constraints will not work if the schema under consideration has a targetNamespace.
  • The XPath expressions used for specifying selectors and fields are a subset of XPath. Currently, only the self, child, and attribute axes are supported.
  • Field values are currently compared in the lexical space. Therefore, the values "1" and "1.0" are NOT equal for a field of type "decimal" (even though they should be).

Finally, note that in <all> model groups fewer than 8 elements must be used.


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/2000/10/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 the Schema.

<document
  xmlns='NS'
  xmlns:xsi='http://www.w3.org/2000/10/XMLSchema-instance' 
  xsi:schemaLocation='NS document.xsd'>
...
</document>

Review the sample file, 'data/personal.xsd' for an example of an XML Schema grammar.



Copyright © 1999, 2000 The Apache Software Foundation. All Rights Reserved.