[All Packages]

XML Schema APIs

XML Schema is an alternative to XML DTDs. It defines the document organization (like DTD), but also provides data typing of element contents and additional features. XML Schema provides many build-in datatypes (scalar, real, date & time, URIs, encoded binary data, etc); user-defined datatypes can then be build up from those primitive datatypes through extension of restriction. See the Schema specification for full details:
XML Schema is still beta! This version implements the April 2000 working draft as well as the August 2000 CR.


Calling Sequence

The sequence of calls to the processor is Initialize, validate, validate, ..., validate, terminate. The initialize call is invoked once at the beginning of a session; it returns a Schema context which is used throughout the session.

The instance document to be validate is first parsed with the XML parser. The XML context for the instance is then passed to the Schema validate function, along with an optional Schema URL. If no explicit Schema is defined in the instance document, the default Schema will be used. More documents may then be processed using the same Schema context. When the session is over, the Schema teardown function is called, which is releases all memory allocated by the loaded Schemas.


Data Types Index

xmlscctx Schema processor context

Function Index

schemaInitialize Initialize the XML Schema processor
schemaValidate Validate an XML document against a Schema
schemaTerminate Shut down the Scheme processor

Data Structures and Types


xmlscctx

Note: The contents of xmlscctx are private (opaque) and must not be accessed by users.


Functions


schemaInitialize

Purpose

Initializes the XML Schema processor; must be called before any Schema validation can take place. The same context may be used repeatedly for validating multiple documents. A pointer to the allocated context is returned, or (xmlscctx *) 0 on error.

Syntax
xmlscctx *schemaInitialize(xmlctx *ctx);
Parameters


schemaValidate

Purpose

Validates an instance document against a Schema. Returns zero on success (the document is structurally valid and all datatypes check out), or a non-zero error code on failure.

Syntax
uword schemaValidate(xmlscctx *scctx, xmlctx *inst, oratext *schema);
Parameters

Comments

The default Schema is only used if the instance document does not explicitly refer to any Schemas.


schemaTerminate

Purpose

Tears down the Schema processor, releasing all allocated memory. The context may not be used again.

Syntax
void schemaTerminate(xmlscctx *scctx);
Parameters