MetaSchemas- Overview and Concepts


Software applications that process XML often need to associate additional information with documents beyond the structures and properties that can be expressed in a schema language.  For example, they may need to specify how XML structures are mapped into object-based or relational systems, provide business logic associated with structures, state how structures should be formatted, or state additional constraints not expressible in the schema language. 

If most applications needed the same set of relatively simple extensions, these extensions should be integrated into the schema language itself.  In practice, the extensions needed by various systems differ widely, and they may need to be specified in many different ways, including XML data, procedural program code, or query statements.  Any schema language that attempted to support the whole range of possible extensions would quickly become unwieldy.

Schema Adjuncts

A more tractable approach is to provide a general framework that allows users to specify additional information about the structures or properties that the schema defines.  For instance, an application that generates HTML forms from XML schemas must associate labels and controls with various elements specified in the schema.  Naturally, no schema language supports such HTML-specific statements.  To fill such needs, the Schema Adjunct Framework introduces the concept of a schema adjunct, an XML document that contains additional, application-specific data relative to a particular schema.  The additional data may be stated in any language that can be placed in an XML document, including query languages, Java, JavaScript, XML-based languages, or prose. 

A schema adjunct provides the information that enables the use of a schema (and its instances) within a particular application.  This means that a given schema can be enabled in a family of interoperating applications by an equal number of adjuncts.  Conversely, a given application can be applied to a variety of schemas by supplying an adjunct for each schema.

Adorned Schemas

While schema adjuncts have advantages as a means of stating meta-data properties, some XML processing applications have need of both the meta-data and the original schema at the same time. In addition, some meta-data is logically and organizationally a direct extension of the schema itself, in the sense that it applies to all applications that process conformant instance documents. Meta-data of this nature can safely be placed within the schema, without violating maintenance best practices.  A schema containing embedded meta-data items is an adorned schema or meta-schema.

Simple Schema Adornment

A schema adjunct containing simple meta-data can be mapped to an adorned schema by simply converting the properties into foreign-namespaced attributes and attaching those attributes to the appropriate declarations in the schema. 

Generalized Schema Adornment

Even when the meta-data items in a schema adjunct are not simple string-valued properties, it is still possible to adorn a schema with that meta-data as long as it meets the simple selector and unique association criteria for simple meta-data. Those criteria guarantee a unique declaration within the target schema to which each meta-data item can be attached.

Adornment of this nature is possible when the target schema language provides means for annotating schemas with structured element content. Both the XML Schema language and XML Data (Reduced) qualify in that regard.

The adornment technique is straightforward: the meta-data items for a given association are simply copied into the appropriate attribute or element declaration in the schema, using namespace qualification on all tag names, and embedded within schema extension syntax as required by the schema language.

Building an Adorned Schema

Read Building MetaSchema to get started on using XML Authority to build an adorned schema.