| Oracle9i XML API Reference - XDK and Oracle XML DB Release 2 (9.2) Part Number A96616-01  | 
  | 
This chapter contains the following sections:
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 nonzero 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 the XML parser function 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 | Description | 
|---|---|
|  
 Initializes Schema processor.  | 
|
|  
 Loads an additional Schema file.  | 
|
|  
 Returns target namespace URI.  | 
|
|  
 Terminates Schema Processor.  | 
|
|  
 Validates an instance document against a Schema.  | 
Initializes Schema processor. Returns error code, or 0 for success.
uword initialize( XMLParser *parser);
| Argument | Description | 
|---|---|
|  
 parser  | 
 
 XMLParser object used for allocating memory.  | 
Explicitly loads a schema (if not already loaded); returns a pointer to the schema, new or old. It is not usually necessary to use this method, as the URL of a default schema may be passed directly to the validate method. Returns error code, 0 for success.
uword load( oratext *uri, oratext *nsp, Schema **schema);
| Argument | Description | 
|---|---|
|  
 uri  | 
 
 URI of Schema, in compiler character set  | 
|  
 nsp  | 
 
 Namespace of Schema (may be   | 
|  
 schema  | 
 
 Returned pointer to schema.  | 
Return its target namespace URI given a Schema handle that is returned by load().
oratext *target( Schema *schema);
| Argument | Description | 
|---|---|
|  
 schema  | 
 
 Schema handle as returned by   | 
Terminate Schema processor, tear down, free memory, and so on. Returns error code, 0 for success
void terminate();
Validates an instance document against a Schema.
uword validate( Element *root, oratext *url);
| Argument | Description | 
|---|---|
|  
 root  | 
 
 root element of the document returned by   | 
|  
 url  | 
 
 URL of default schema; optional  | 
  | 
![]() Copyright © 2001, 2002 Oracle Corporation. All Rights Reserved.  | 
  |