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 24 September 1999 Working Draft. 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.

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 at xml4j@us.ibm.com.

Limitations

 

The XML Schema implementation in this package is a subset of the features defined in the 24 September 1999 XML Schema Working Drafts.

Structure Limitations

 

  • elementDecls, archeTypes, modelGroups and attributeGroup share the same namespace
  • All archetypes, elements, modelGroups and attributeGroups must be declared before they are used.
  • On archetypes the following are unsupported:
    • open, refinable, and closed models
    • nested element decls
  • None of the items in section 5, import, inclusion, export, or refinement, are supported.

Datatype Limitations

 

  • Datatype checking conforms to underlying Java types, not necessarily to schema rules:
  • Schema type

    Java type

    boolean

    Boolean

    integer

    Integer

    decimal

    Double

    real

    Double

    The NMTOKEN, NMTOKENS, Name, NCName, ID, IDREF, ENTITY, ENTITIES, NOTATION are only supported on attributes. At the moment they cannot be applied to element content.
  • The timeInstant, timeDuration, recurringInstant, date, time, binary, uri, and language datatypes are not supported.
  • Datatype qualifiers on attributes are not supported.

Other Limitations

 

The schema is specified by the first xmlns attribute on the root element of the document. There must be an attribute declaration for this xmlns attribute.

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 xmlns attribute attached to the root / top-level element in the document. Here is an example:

    <document xmlns='document.xsd>

    ...

    </document>

Another requirement is that the XML Schema document's grammar must have a <!DOCTYPE ...> line specifying the DTD for XML Schema grammar. The DOCTYPE must specify the following system identifier:

    http://www.w3.org/XML/Group/1999/09/23-xmlschema/structures/structur es.dtd

Also, there must be an attribute declaration for the xmlns attribute used to find the schema (document in the example above).

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