Skip Headers

Oracle® XML Developer's Kit Programmer's Guide
10g Release 1 (10.1)

Part Number B10794-01
Go to Documentation Home
Go to Book List
Book List
Go to Table of Contents
Go to Index
Go to Master Index
Master Index
Go to Feedback page

Go to previous page
Go to next page
View PDF

16 XML Schema Processor for C


Use the new unified C API for new XDK and Oracle XML DB applications. The old C functions are deprecated and supported only for backward compatibility, but will not be enhanced. They will be removed in a future release.

The new C API is described in Chapter 14, " XML Parser for C".

This chapter contains these topics:

Oracle XML Schema Processor for C

The XML Schema Processor for C is a companion component to the XML Parser for C. It allows support for simple and complex datatypes in XML applications.

The XML Schema Processor for C supports the W3C XML Schema Recommendation. This makes writing custom applications that process XML documents straightforward, and means that a standards-compliant XML Schema Processor is part of the XDK on every operating system where Oracle is ported.

See Also:

Chapter 3, " XML Parser for Java", for more information about XML Schema and why you would want to use XML Schema.

Oracle XML Schema for C Features

XML Schema Processor for C has the following features:

  • Supports simple and complex types

  • Built on XML Parser for C

  • Supports the W3C XML Schema Recommendation

See Also:

Standards Conformance

The Schema Processor conforms to the following standards:

  • W3C recommendation for Extensible Markup Language (XML) 1.0

  • W3C recommendation for Document Object Model Level 1.0

  • W3C recommendation for Namespaces in XML

  • W3C recommendation for XML Schema

XML Schema Processor for C: Supplied Software

Table 16-1 lists the supplied files and directories for this release:

Table 16-1 XML Schema Processor for C: Supplied Files

Directory and Files Description
bin schema processor executable, schema
lib XML/XSL/Schema & support libraries
nls/data Globalization Support data files
xdk/demo/c/schema example usage of the Schema processor
xdk/include header files
xdk/mesg error message files
xdk/readme.html introductory file

Table 16-2 lists the included libraries:

Table 16-2 XML Schema Processor for C: Supplied Libraries

Included Library Description
libxml10.a XML Parser, XSL Processor, XML Schema Processor
libcore10.a CORE functions
libnls10.a Globalization Support

Invoking XML Schema Processor for C

XML Schema Processor for C can be called as an executable by invoking bin/schema in the install area. This takes two arguments:

The XML Schema Processor for C can also be invoked by writing code using the supplied APIs. The code must be compiled using the headers in the include subdirectory and linked against the libraries in the lib subdirectory. See Makefile in the xdk/demo/c/schema subdirectory for details on how to build your program.

Error message files in different languages are provided in the mesg/ subdirectory.

XML Schema Processor for C Usage Diagram

Figure 16-1 describes the calling sequence for the XML Schema Processor for C, as follows:

The sequence of calls to the processor is: initialize, load, validate, validate,..., validate, terminate.

  1. The initialize call is invoked once at the beginning of a session; it returns a schema context which is used throughout the session.

  2. Schema documents to be used in the session are loaded in advance.

  3. The instance document to be validated is first parsed with the XML parser.

  4. The top of the XML element subtree for the instance is then passed to the schema validate function.

  5. If no explicit schema is defined in the instance document, any pre-loaded schemas will be used.

  6. More documents can then be validated using the same schema context.

  7. When the session is over, the Schema tear-down function is called, which releases all memory allocated for the loaded schemas.

Figure 16-1 XML Schema Processor for C Usage Diagram

Description of adxdk092.gif follows
Description of the illustration adxdk092.gif

How to Run XML Schema for C Sample Programs

The directory xdk/demo/c/schema contains sample XML Schema applications that illustrate how to use Oracle XML Schema Processor with its API. Table 16-3 lists the provided sample files.

Table 16-3 XML Schema for C Samples Provided

Sample File Description


Makefile to build the sample programs and run them, verifying correct output.


Program which invokes the XML Schema for C API


Sample schema, instance document, and expected output respectively, after running xsdtest on them.


Second sample schema, instance document, and expected output respectively, after running xsdtest on them.


Third sample schema, instance document, and expected output respectively, after running xsdtest on them.

To build the sample programs, run make.

To build the programs and run them, comparing the actual output to expected output:

make sure