Skip Headers

Oracle9i XML API Reference - XDK and Oracle XML DB
Release 2 (9.2)

Part Number A96616-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

18
XML Schema Processor for C++

This chapter contains the following sections:


XMLSchema Class


Description of XMLSchema

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.


Functions of XMLSchema

Table 18-1 Summary of Functions of XMLSchema
Function Description

initialize()

Initializes Schema processor.

load()

Loads an additional Schema file.

target()

Returns target namespace URI.

terminate()

Terminates Schema Processor.

validate()

Validates an instance document against a Schema.

initialize()

Description

Initializes Schema processor. Returns error code, or 0 for success.

Syntax

uword initialize( XMLParser *parser);
Argument Description

parser

XMLParser object used for allocating memory.

load()

Description

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.

Syntax

uword load( oratext *uri,
            oratext *nsp,
            Schema **schema); 

Argument Description

uri

URI of Schema, in compiler character set

nsp

Namespace of Schema (may be NULL), in compiler character set.

schema

Returned pointer to schema.

target()

Description

Return its target namespace URI given a Schema handle that is returned by load().

Syntax

oratext *target( Schema *schema);

Argument Description

schema

Schema handle as returned by load() method.

terminate()

Description

Terminate Schema processor, tear down, free memory, and so on. Returns error code, 0 for success

Syntax

void terminate();

validate()

Description

Validates an instance document against a Schema.

Syntax

uword validate( Element *root,
                oratext *url);

Argument Description

root

root element of the document returned by parser.getDocuemntElement()

url

URL of default schema; optional


Go to previous page Go to next page
Oracle
Copyright © 2001, 2002 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