Oracle9i Application Developer's Guide - XML Release 1 (9.0.1) Part Number A88894-01 |
|
This appendix contains the following sections:
Oracle provides a set of XML parsers for Java, C, C++, and PL/SQL. Each of these parsers is a stand-alone XML component that parses an XML document (or a standalone DTD) so that it can be processed by an application. Library and command-line versions are provided supporting the following standards and features:
The XML Parser for C++ can parse XML in validating or non-validating modes.
Validation involves checking whether or not the attribute names and element tags are legal, whether nested elements belong where they are, and so on.
See Chapter 26, "Using XML Parser for C++" for example code and suggestions on how to use the XML Parser for C++.
Documentation for Oracle XML Parser for C++ is located in the $ORACLE_HOME/xdk/cpp/parser/doc directory.
The readme.html file in the root directory of the archive contains release specific information including bug fixes, API additions, and so on.
The Oracle XML parser for C++ is written in C with C++ wrappers. It will check if an XML document is well-formed, and optionally validate it against a DTD. The parser will construct an object tree which can be accessed via a DOM interface or operate serially via a SAX interface.
XML Parser for C++ conforms to the following standards:
XML Parser for C++ supports documents in the following encodings, in addition to the ones specified in Appendix A, "Character Sets", of Oracle9i Globalization and National Language Support Guide:
The default encoding is UTF-8. It is recommended that you set the default encoding explicitly if using only single byte character sets (such as US-ASCII or any of the ISO-8859 character sets) for performance up to 25% faster than with multibyte character sets, such as UTF-8.
Table F-1 lists the XML Parser for C++ revision history.
Table F-2 lists the main XML Parser for C++,class XMLParser() methods with a brief description of each. XMLParser() class contains top-level methods that do the following:
Table F-2 XML Parser for C++: XMLParser() Class
Table F-3 lists the XML Parser for C ++ DOM API methods a brief description of each.
XSLT is a language for tranforming XML documents into other XML documents. It is designed for use as part of XSL, which is a stylesheet language for XML. In addition to XSLT, XSL includes an XML vocabulary for specifying formatting. XSL specifies the styling of an XML document by using XSLT to describe how the document is transformed into another XML document that uses the formatting vocabulary.
XSLT is also designed to be used independently of XSL. However, XSLT is not intended as a completely general-purpose XML transformation language. Rather it is designed primarily for the kinds of transformation that are needed when XSLT is used as part of XSL.
A transformation expressed in XSLT describes rules for transforming a source tree into a result tree. The transformation is achieved by associating patterns with templates. A pattern is matched against elements in the source tree. A template is instantiated to create part of the result tree. The result tree is separate from the source tree. The structure of the result tree can be completely different from the structure of the source tree. In constructing the result tree, elements from the source tree can be filtered and reordered, and arbitrary structure can be added.
A transformation expressed in XSLT is called a stylesheet. This is because, in the case when XSLT is transforming into the XSL formatting vocabulary, the transformation functions as a stylesheet.
A stylesheet contains a set of template rules. A template rule has two parts:
A template is instantiated for a particular source element to create part of the result tree. A template can contain elements that specify literal result element structure. A template can also contain elements from the XSLT namespace that are instructions for creating result tree fragments. When a template is instantiated, each instruction is executed and replaced by the result tree fragment that it creates.
Instructions can select and process descendant source elements. Processing a descendant element creates a result tree fragment by finding the applicable template rule and instantiating its template. Note that elements are only processed when they have been selected by the execution of an instruction. The result tree is constructed by finding the template rule for the root node and instantiating its template.
A software module called an XSL processor reads XML documents and transforms them into other XML documents with different styles.
XML Parser for C++ implementation of the XSL processor follows the XSL Transformations standard (version 1.0, November 16, 1999) and includes the required behavior of an XSL processor as specified in the XSLT specification.
Table F-4 lists the XSLProcessor class methods and syntax summary.
The SAX API is based on callbacks. Instead of the entire document being parsed and turned into a data structure which may be referenced (by the DOM interface), the SAX interface is serial. As the document is processed, appropriate SAX user callback functions are invoked. Each callback function returns an error code, zero meaning success, any non-zero value meaning failure. If a non-zero code is returned, document processing is stopped.
To use SAX, an xmlsaxcb structure is initialized with function pointers and passed to the xmlinit() call. A pointer to a user-defined context structure may also be included; that context pointer will be passed to each SAX function.
This SAX functionality is identical to the XML Parser for C version.
Table F-5 lists the XML Parser for C++, SAX API functions.
Working in conjunction with the XML Parser for C++, the XML Class Generator generates a set of C++ source files based on an input DTD. The generated C++ source files can then be used to construct, optionally validate, and print a XML document that is compliant to the DTD specified. The Class Generator supports validation mode to assist debugging.
Input is an XML document containing a DTD. The document body itself is ignored; only the DTD is relevant, though the dummy document must conform to the DTD. The underlying XML parser only accepts file names for the document and associated external entities. In future releases, no dummy document will be required, and URIs for additional protocols will be accepted.
The following lists supported Character Set Encoding for files input to XML C++ Class Generator. These are in addition to the character sets specified in Appendix A, "Character Sets", of Oracle9i Globalization and National Language Support Guide.
The default encoding is UTF-8. It is recommended that you set the default encoding explicitly if using only single byte character sets (such as US-ASCII or any of the ISO-8859 character sets) for performance up to 25% faster than with multibyte character sets, such as UTF-8.
XML Parser for C++ output is a pair of C++ source files, .cpp and .h, named after the DTD. Constructors are provided for each class (element) that allow an object to be created in two different ways: initially empty, then adding the children or data after the initial creation, or created with the initial full set of children or initial data. A method is provided for #PCDATA (and Mixed) elements to set the data and, when appropriate, set an element's attributes.
XML C++ Class Generator conforms to the following "Standards":
The XML C++ Class Generator has the following file and directory structure:
license.html licensing agreement bin/ Standalone Class Generator "xmlcg" doc/ API documentation include/ Header files lib/ XML and support libraries mesg/ Error message files (including cause/action information in the .msg) sample/ Example usage
Table F-6 lists the libraries included with XML C++ Class Generator.
|
Copyright © 1996-2001, Oracle Corporation. All Rights Reserved. |
|