Oracle8i Application Developer's Guide - XML Release 3 (8.1.7) Part Number A86030-01 |
Library | Service | Contents | Index

Using XML Parser for Java, 2 of 22

## XML Parser for Java: Features

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:

- DOM (Document Object Model) support is provided compliant with the W3C DOM 1.0 Recommendation. These APIs permit applications to access and manipulate an XML document as a tree structure in memory. This interface is used by such applications as editors.

- SAX (Simple API for XML) support is also provided compliant with the SAX 1.0 specification. These APIs permit an application to process XML documents using an event-driven model.

- Support is also included for XML Namespaces 1.0 thereby avoiding name collisions, increasing reusability and easing application integration.

- Able to run on Oracle8i, iAS (Internet Application Server), and OIS (Oracle Integration Server)

Additional features include:

- Validating and non-validating modes

- Built-in error recovery until fatal error

- DOM extension APIs for document creation

The parsers are available on all Oracle platforms.

See Figure 17-1. The XML Parser for Java inputs an XML document. The DOM or SAX parser interface parses the XML document. The parsed XML is then transferred to the application for further processing.

If a stylesheet is used, the DOM or SAX interface also parses and outputs the XSL commands. These are sent together with the parsed XML to the XSL-T Processor where the selected stylesheet is applied and the transformed (new) XML document is then output.

See Also: Appendix C, "XDK for Java: Specifications and Cheat Sheets".

#### Figure 17-1 Oracle XML Parser

DOM and SAX APIs are explained in "DOM and SAX APIs".

The classes and methods used to parse an XM document are illustrated in the following diagrams:

- Figure 17-4, "XML Parser for Java: DOMParser()"

- Figure 17-5, "Using SAXParser() Class"

The classes and methods used by the XSL-T Processor to apply stylesheets are illustrated in the following diagram:

- Figure 17-6, "XSLProcessor Class Process"

### XSL Transformation (XSL-T) Processor

The V2 versions of the XML Parsers include an integrated XSL Transformation (XSL-T) Processor for transforming XML data using XSL stylesheets. Using the XSL-T processor, you can transform XML documents from XML to XML, XML to HTML, or to virtually any other text-based format. See Figure 17-1.

The processor supports the following standards and features:

- Compliant with the W3C XSL Transform Proposed Recommendation 1.0

- Compliant with the W3C XPath Proposed Recommendation 1.0

- Integrated into the XML Parser for improved performance and scalability

- Available with library and command-line interfaces for Java, C, C++, and PL/SQL

### Namespace Support

The Java, C, and C++ XML parsers also support XML Namespaces. Namespaces are a mechanism to resolve or avoid name collisions between element types (tags) or attributes in XML documents.

This mechanism provides "universal" namespace element types and attribute names whose scope extends beyond this manual.

Such tags are qualified by uniform resource identifiers (URIs), such as:

    <oracle:EMP xmlns:oracle="http://www.oracle.com/xml"/>

For example, namespaces can be used to identify an Oracle <EMP> data element as distinct from another company's definition of an <EMP> data element.

This enables an application to more easily identify elements and attributes it is designed to process. The Java, C, and C++ parsers support namespaces by being able to recognize and parse universal element types and attribute names, as well as unqualified "local" element types and attribute names.

### Validating and Non-Validating Mode Support

The Java, C, and C++ parsers can parse XML in validating or non-validating modes.

- Non-Validating Mode: The parser verifies that the XML is well-formed and parses the data into a tree of objects that can be manipulated by the DOM API.

- Validating Mode: The parser verifies that the XML is well-formed and validates the XML data against the DTD (if any).

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 Also: Oracle8i XML Reference

| Copyright © 1996-2000, Oracle Corporation. All Rights Reserved. |
Library | Service | Contents | Index