|Oracle® XML Developer's Kit Programmer's Guide
10g Release 2 (10.2)
|PDF · Mobi · ePub|
This chapter contains these topics:
Note: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 15, "Using the XML Parser 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, "Using the XML Parser for Java", for more information about XML Schema and why you would want to use XML Schema.
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
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
Table 17-1 lists the supplied files and directories for this release.
|Directory and Files||Description|
||schema processor executable,
||XML/XSL/Schema & support libraries|
||Globalization Support data files|
||example usage of the Schema processor|
||error message files|
Table 17-2 lists the included libraries.
XML Schema processor for C can be called as an executable by invoking
bin/schema in the install area. This takes two arguments:
XML instance document
Optionally, a default schema
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
Figure 17-1 describes the calling sequence for the XML Schema processor for C, as follows:
The initialize call is invoked once at the beginning of a session; it returns a schema context which is used throughout the session.
Schema documents to be used in the session are loaded in advance.
The instance document to be validated is first parsed with the XML parser.
The top of the XML element subtree for the instance is then passed to the schema validate function.
If no explicit schema is defined in the instance document, any pre-loaded schemas will be used.
More documents can then be validated using the same schema context.
When the session is over, the Schema tear-down function is called, which releases all memory allocated for the loaded schemas.
xdk/demo/c/schema contains sample XML Schema applications that illustrate how to use Oracle XML Schema processor with its API. Table 17-3 lists the provided sample files.
||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
||Second sample schema, instance document, and expected output respectively, after running
||Third sample schema, instance document, and expected output respectively, after running
To build the sample programs, run
To build the programs and run them, comparing the actual output to expected output: