Oracle9i XML Reference
Release 1 (9.0.1)

Part Number A88899-01
Go To Documentation Library
Home
Go To Product List
Book List
Go To Table Of Contents
Contents
Go To Index
Index

Master Index

Feedback

Go to previous page Go to next page

8
XML Schema Processor for C

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.

Schema APIs

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.

Function/Method Index


Table 8-1
Function/Method  Description 

schemaInitialize 

Initialize the schema processor 

schemaValidate 

Validate an instance document against a schema 

schemaTerminate 

Terminates (tears down) the schema processor 


Functions

schemaInitialize

Purpose

Initializes the XML schema processor. Must be called before the processor can be used to validate any documents.

xsdctx *schemaInitialize(xmlctx *ctx, uword *err)

Parameters

ctx (IN)  XML parser context
err (OUT) Returned error code

Comments

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 schema context is returned, and must be passed to all subsequent schema functions. This context pointer is opaque-- you cannot reference its members. If the return context is NULL, initialization failed and err will be set with the numeric error code indicating the problem.

schemaValidate

Purpose

Validates an instance document against a schema or schemas.

uword schemaValidate(xsdctx *scctx, xmlctx *inst, oratext *schema)

Parameters

scctx  (IN) Schema context
inst   (IN) Instance document context
schema (IN) URL of fefault schema

Comments

This is the function which actually performs schema validation. The schema context returned by schemaInitialize must be passed in.

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.

schemaTerminate

Purpose

Terminates (shuts down) the schema processor, freeing all memory allocated on the original XML parser context passed to schemaInitialize.

void schemaTerminate(xsdctx *scctx)

Parameters

scctx (IN) Schema context

Comments

After termination, the schema context is no longer valid. To continue using the schema processor, a new schema must be created with schemaInitialize.


Go to previous page Go to next page
Oracle
Copyright © 1996-2001, Oracle Corporation.

All Rights Reserved.
Go To Documentation Library
Home
Go To Product List
Book List
Go To Table Of Contents
Contents
Go To Index
Index

Master Index

Feedback