Skip Headers
Oracle® Database XML C API Reference
11g Release 2 (11.2)

Part Number E10770-02
Go to Documentation Home
Home
Go to Book List
Book List
Go to Table of Contents
Contents
Go to Index
Index
Go to Master Index
Master Index
Go to Feedback page
Contact Us

Go to previous page
Previous
Go to next page
Next
PDF · Mobi · ePub
CAXML05000

8 Package Schema APIs for C

This C implementation of the XML schema validator follows the W3C XML Schema specification, rev REC-xmlschema-1-20010502. It implements the required behavior of a schema validator for multiple schema documents to be assembled into a schema. This resulting schema can be used to validate a specific instance document.

For event-based schema validation, see the methods documented in Chapter 4, "Package Event APIs for C".

This chapter contains the following section:

See Also:

CAXML5964

Schema Interface

Table 8-1 summarizes the methods available through the Schema interface.

CAXML5965Table 8-1 Summary of Schema Methods

Function Summary

XmlSchemaClean()

Cleans up loaded schemas in a schema context and recycle the schema context.

XmlSchemaCreate()

Creates and returns a schema context.

XmlSchemaDestroy()

Destroys a schema context.

XmlSchemaErrorWhere()

Returns the location where an error occurred.

XmlSchemaLoad()

Loads a schema document.

XmlSchemaLoadedList()

Returns the size and/or list of loaded schema documents.

XmlSchemaSetErrorHandler()

Sets an error message handler and its associated context in a schema context

XmlSchemaSetValidateOptions()

Sets option(s) to be used in the next validation session.

XmlSchemaTargetNamespace()

Returns target namespace of a given schema document.

XmlSchemaUnload()

Unloads a schema document.

XmlSchemaValidate()

Validates an element node against a schema.

XmlSchemaVersion()

Returns the version of this schema implementation.


CAXML5966

XmlSchemaClean()

Clean up loaded schemas in a schema context and recycle the schema context.

CAXML5967Syntax

void XmlSchemaClean(
   xsdctx *sctx);
Parameter In/Out Description
sctx
IN
schema context to be cleaned

CAXML5968

XmlSchemaCreate()

Return a schema context to be used in other validator APIs. This needs to be paired with an XmlSchemaDestroy.

CAXML5969Syntax

xsdctx *XmlSchemaCreate(
   xmlctx *xctx, 
   xmlerr *err, 
   list);
Parameter In/Out Description
xctx
IN
XML context
err
OUT
returned error code
list
IN
NULL-terminated list of variable arguments

CAXML5970Returns

(xsdctx *) schema context

CAXML5971

XmlSchemaDestroy()

Destroy a schema context and free up all its resources.

CAXML5972Syntax

void XmlSchemaDestroy(
   xsdctx *sctx);
Parameter In/Out Description
sctx
IN
schema context to be freed

CAXML5973

XmlSchemaErrorWhere()

Returns the location (line#, path) where an error occurred.

CAXML5974Syntax

xmlerr XmlSchemaErrorWhere(
   xsdctx *sctx, 
   ub4 *line, 
   oratext **path);
Parameter In/Out Description
sctx
IN
schema context
line
IN/OUT
line number where error occurred
path
IN/OUT
URL or filespace where error occurred

CAXML5975Returns

(xmlerr) error code

CAXML5976

XmlSchemaLoad()

Load up a schema document to be used in the next validation session. Schema documents can be incrementally loaded into a schema context as long as every loaded schema document is valid. When the last loaded schema turns out to be invalid, you need to clean up the schema context by calling XmlSchemaClean() and reload everything all over again including the last schema with appropriate correction.

Given a schema document, this function converts the DOM representation into an internal schema representation. The schema document can be provided as a URI or directly a DOM representation. In the URI case, this function reads the input stream and builds a DOM representation of the schema before converting it into internal representation. In the DOM case, the application can provide a DOM representation of the schema, which will be used to create the internal schema representation.

CAXML5977Syntax

xmlerr XmlSchemaLoad(
   xsdctx *sctx, 
   oratext *uri, 
   list);
Parameter In/Out Description
sxctx
IN
schema context
uri
IN
URL of schema document; compiler encoding
list
IN
NULL-terminated list of variable arguments

CAXML5978Returns

(xmlerr) numeric error code, XMLERR_OK [0] on success

CAXML5979

XmlSchemaLoadedList()

Return only the size of loaded schema documents if list is NULL. If list is not NULL, a list of URL pointers are returned in the user-provided pointer buffer. Note that its user's responsibility to provide a buffer with big enough size.

CAXML5980Syntax

ub4 XmlSchemaLoadedList(
   xsdctx *sctx, 
   oratext **list);
Parameter In/Out Description
sctx
IN
schema context
list
IN
address of pointer buffer

CAXML5981Returns

(ub4) list size

CAXML5982

XmlSchemaSetErrorHandler()

Sets an error message handler and its associated context in a schema context. To retrieve useful location information on errors, the address of the schema context must be provided in the error handler context.

CAXML5983Syntax

xmlerr XmlSchemaSetErrorHandler(
   xsdctx *sctx, 
   XML_ERRMSG_F(
      (*errhdl), 
      ectx, 
      msg, 
      err), 
   void *errctx);
Parameter In/Out Description
sctx
IN
schema context
errhdl
IN
error message handler
errctx
IN
error handler context

CAXML5984Returns

(xmlerr) error code

CAXML5985

XmlSchemaSetValidateOptions()

Set options to be used in the next validation session. Previously set options will remain effective until they are overwritten or reset.

CAXML5986Syntax

xmlerr XmlSchemaSetValidateOptions(
   xsdctx *sctx, 
   list);
Parameter In/Out Description
sctx
IN
schema context
list
IN
NULL-terminated list of variable argument

CAXML5987Returns

(xmlerr) numeric error code, XMLERR_OK [0] on success

CAXML5988

XmlSchemaTargetNamespace()

Return target namespace of a given schema document identified by its URI. All currently loaded schema documents can be queried. Currently loaded schema documents include the ones loaded through XmlSchemaLoads and the ones loaded through schemaLocation or noNamespaceSchemaLocation hints.

CAXML5989Syntax

oratext *XmlSchemaTargetNamespace(
   xsdctx *sctx, 
   oratext *uri);
Parameter In/Out Description
sctx
IN
XML context
uri
IN
URL of the schema document to be queried

CAXML5990Returns

(oratext *) target namespace string; NULL if given document not

CAXML5991

XmlSchemaUnload()

Unload a schema document from the validator. All previously loaded schema documents will remain loaded until they are unloaded. To unload all loaded schema documents, set URI to be NULL (this is equivalent to XmlSchemaClean). Note that all children schemas associated with the given schema are also unloaded. In this implementation, it only support the following scenarios:

It doesn't not support: load, load, unload, load, ....

CAXML5992Syntax

xmlerr XmlSchemaUnload(
   xsdctx *sctx, 
   oratext *uri, 
   list);
Parameter In/Out Description
sctx
IN
schema context
uri
IN
URL of the schema document; compiler encoding
list
IN
NULL-terminated list of variable argument

CAXML5993Returns

(xmlerr) numeric error code, XMLERR_OK [0] on success

CAXML5994

XmlSchemaValidate()

Validates an element node against a schema. Schemas used in current session consists of all schema documents specified through XmlSchemaLoad and provided as hint(s) through schemaLocation or noNamespaceSchemaLocation in the instance document. After the invocation of this routine, all loaded schema documents remain loaded and can be queried by XmlSchemaLoadedList. However, they will remain inactive. In the next validation session, inactive schema documents can be activated by specifying them through XmlSchemaLoad or providing them as hint(s) through schemaLocation or noNamespaceSchemaLocation in the new instance document. To unload a schema document and all its descendants (documents included or imported in a nested manner), use XmlSchemaUnload.

CAXML5995Syntax

xmlerr XmlSchemaValidate(
   xsdctx *sctx,
   xmlctx *xctx, 
   xmlelemnode *elem);
Parameter In/Out Description
sctx
IN
schema context
xctx
IN
XML top-level context
elem
IN
element node in the doc, to be validated

CAXML5996Returns

(xmlerr) numeric error code, XMLERR_OK [0] on success

CAXML5997

XmlSchemaVersion()

Return the version of this schema implementation.

CAXML5998Syntax

oratext *XmlSchemaVersion();

CAXML5999Returns

(oratext *) version string [compiler encoding]

Reader Comment

   

Comments, corrections, and suggestions are forwarded to authors every week. By submitting, you confirm you agree to the terms and conditions. Use the OTN forums for product questions. For support or consulting, file a service request through My Oracle Support.

Hide Navigation

Quick Lookup

Database Library · Master Index · Master Glossary · Book List · Data Dictionary · SQL Keywords · Initialization Parameters · Advanced Search · Error Messages

Main Categories

This Page

  • Schema Interface
    • XmlSchemaClean()
    • XmlSchemaCreate()
    • XmlSchemaDestroy()
    • XmlSchemaErrorWhere()
    • XmlSchemaLoad()
    • XmlSchemaLoadedList()
    • XmlSchemaSetErrorHandler()
    • XmlSchemaSetValidateOptions()
    • XmlSchemaTargetNamespace()
    • XmlSchemaUnload()
    • XmlSchemaValidate()
    • XmlSchemaVersion()

This Document

New and changed documents:
RSS Feed HTML RSS Feed PDF