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

Using XML Parser for C++, 4 of 10

## XML Parser for C++ Usage

Figure 22-1 illustrates the XML Parser for C++ functionality.

1. The parsing process begins with the `xmlinit()` method.

2. The XML input can be either an XML file or string buffer. This inputs the following methods:

   - `XMLParser.xmlparse()` if the input is an XML file

   - `XMLParser.xmlparseBuffer()` if the input is a string buffer

3. DOM or SAX API

   DOM: If you are using the DOM interface, include the following steps:

   - The `XMLParser.xmlparse()` or .`xmlparserBuffer()` method calls `.getDocument Element()`. If no other DOM methods are being applied, you can invoke `.xmlterm()`.

   - This optionally calls other DOM methods if required. These are typically Node class methods or print methods. It outputs the DOM document.

   - If complete, the process invokes `.xmlterm()`

   - You can optionally first invoke `.xmlclean()` to clean up any data structure created during the parse process. You would then call `.xmlterm()`

   SAX: If you are using the SAX interface, include the following steps:

   - Process the results of the parser from `.xmlparse()` or `.xmlparseBuffer()` via callback methods.

   - Register the callback methods

4. Optionally, use`.xmlclean()` to clean up the memory and structures used during a parse, and go to Step 5. or return to Step 2.

5. Terminate the parsing process with .`xmlterm()`

#### Parser Calling Sequence

The sequence of calls to the parser can be any of the following:

- `XMLParser.xmlinit() - XMLParser.xmlparse()` or

  `XMLParser.xmlparsebuf() - XMLParser.xmlterm()`

- `XMLParser.xmlinit() - XMLParser.xmlparse()` or

  `XMLParser.xmlparsebuf() - XMLParser.xmlclean() - XMLParser.xmlparse()` or

  `XMLParser.xmlparsebuf() - XMLParser.xmlclean() - ... - XMLParser.xmlterm()`

- `XMLParser.xmlinit() - XMLParser.xmlparse()` or

  `XMLParser.xmlparsebuf() - XMLParser.xmlparse()` or

  `XMLParser.xmlparsebuf() - ... - XMLParser.xmlterm()`

#### Figure 22-1 XML Parser for C++ (DOM and SAX Interfaces) Usage

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