Skip navigation links

Package com.luciad.format.xml.bind.schema

Provides an extension to the XML runtime binding framework com.luciad.format.xml.bind for XML Schema based documents.

See: Description

Package com.luciad.format.xml.bind.schema Description

Provides an extension to the XML runtime binding framework com.luciad.format.xml.bind for XML Schema based documents.

XML Schema adds extra power on top of XML; to fully exploit the features of XML Schema, additional classes are provided by the XML binding framework.


The TLcdXMLSchemaBasedDecoder is responsible for decoding XML documents. Once it has been configured with one or more data models, it can decode XML documents into the Java domain classes defined by the data models. The decoding process is highly configurable. The decoder supports an input stream factory, a XML reader factory and (via its mapping) an entity resolver. These objects allow the application to control how the decoder gets its input (both document and schema). In addition, the XML framework allows application-specific decoding of XML elements or types.
While ILcdXMLUnmarshaller is responsible for decoding XML elements, ILcdXMLTypeUnmarshaller is responsible for decoding XML Schema types. The ILcdXMLTypeUnmarshaller interface allows to chain a set of schema type unmarshallers corresponding to the XML Schema type hierarchy, each type unmarshaller responsible for unmarshalling only those attributes and child elements which are defined in the corresponding type. See the documentation of the ILcdXMLTypeUnmarshaller for detailed information on how to write XML Schema type unmarshallers.
XML Schema defines a set of built-in datatypes. In addition, schemas can derive their own types from this set of built-in types. Datatypes are used to define the value space of attributes or the simple content of elements. The ILcdXMLDatatypeUnmarshaller interface should be implemented by all unmarshallers for datatypes.
Elements of one XML schema might have a type which is defined in another schema. In order to be able to share and reuse type unmarshallers among decoder libraries for different XML schemas, it should be possible to share type unmarshallers based on their XML Schema type, instead of XML element. The TLcdXMLTypeUnmarshallerProvider is a repository on which type unmarshallers for XML Schema types and datatypes can be registered.
XML schemas contain information about elements and types. Parts of the schema are needed by the framework to take full advantage of XML schema. This information is stored in the TLcdXMLSchemaSet class.
The ILcdXMLSchemaBasedDecoderLibrary bundles all information associated with a set of XML unmarshallers for a given XML schema in a single class. Typically, a library is written for each XML schema. A decoder can be instantiated by creating a set of library instances, one for each of the schemas that are used, and passing this set to the constructor of the decoder; the decoder will automatically configure itself by calling one-by-one each of the registration methods for each of the libraries.

Mapping XML substitution groups onto Java class hierarchies

XML Schema provides a mechanism, called substitution groups, that allows elements to be substituted for other elements.

Although one is free to use an arbitrary mapping between XML Schema and Java domain model, the following approach offers maximal extensibility and handles substitution groups in a very natural way:


The main XML Schema marshaller API classes, TLcdXMLSchemaBasedEncoder, ILcdXMLTypeMarshaller, ILcdXMLDatatypeMarshaller, TLcdXMLTypeMarshallerProvider, and ILcdXMLSchemaBasedEncoderLibrary are similar in use to their unmarshaller counterparts.

Mapping Java class hierarchies onto XML substitution groups

Java's class extension mechanism allows to assign to a member field of an object, an instance of a subclass of the field's class. Such a subclass might have additional properties and it might be desirable to map this subclass onto another XML element than the XML element onto which the field's class is mapped. The XML Schema substitution group mechanism can be used to handle this Java extension mechanism in a very natural way, as follows:

Schema mapping

Common to both encoder and decoder is the TLcdXMLSchemaBasedMapping. This class is responsible for mapping XML schema types on Java classes. It supports the registration of object factories that can create Java objects for a combination of an XML schema type and a Java class. In addition, the mapping keeps track of the necessary schema information (such as for instance information on XML substitution groups).
Skip navigation links