Oracle9i XML Reference Release 1 (9.0.1) Part Number A88899-01 |
|
This chapter describes:
Note:This beta implementation is incomplete at present; not all schema features are implemented. Also, features can be expected to evolve further before stabilizing.
The schema API is very simple: initialize, validate,...validate, terminate.
The validation process is go/no-go. Either the document is valid with respect to the schemas or it is invalid. When it is valid, a zero error code is returned. When it is invalid, a non-zero error code is returned indicating the problem. There is no distinction between warnings and errors; all problems are errors and considered fatal: validation stops immediately.
As schemas are encountered, they are loaded and preserved in the schema context. No schema is loaded more than once during a session. There is no clean up call similar to xmlclean. Hence, if you need to release all memory and reset state before validating a new document, you must terminate the context and start over.
Initializes the XML schema processor. Must be called before the processor can be used to validate any documents.
uword initialize(xmlctx *ctx)
ctx (IN) XML parser context
The XML parser context is used to allocate memory for the schema context. Note this is not the context of the instance document to be validated.
The context is stored internally and need not be passed around. An error code is returned directly. As always, it is zero on success, non-zero on failure.
Validates an instance document against a schema or schemas.
uword validate(xmlctx *inst, oratext *schema)
inst (IN) Instance document context schema (IN) URL of fefault schema
This is the function which actually performs schema validation. The document to be validated is specified by the XML parser context inst used to parse the document. Note the document must already have been parsed.
If no schemas are explicitly referenced in the instance document, the default schema (specified by URL) is assumed. If the document does specify all necessary schemas, and a default schema is also supplied, the default will be ignored. If the document does not reference any schemas and no default is supplied, an error will result.
Terminates (shuts down) the schema processor, freeing all memory allocated on the original XML parser context passed to XMLSchema::Initialize.
void terminate(void)
After termination, the schema context is no longer valid. To continue using the schema processor, a new schema must be created with XMLSchema::Initialize.
|
Copyright © 1996-2001, Oracle Corporation. All Rights Reserved. |
|