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 21-1 illustrates the XML Parser for C functionality as follows:

1. `XMLinit()` function initializes the parsing process.

2. The parsed item can be an XML document (file) or string buffer. If the input is an XML document or file, it is parsed using the `xmlparser()` function. If the input is a string buffer, it is parsed using the `xmlparserbuf()` function.

3. DOM or SAX API:

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

   - The `xmlparse()` or `xmlparseBuffer()` function calls `.getDocumentElement()`. If no other DOM functions are being applied, you can invoke `xmlterm()`.

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

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

   - You can optionally first invoke `xmlclean()` to clean up any data structures 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 `xmlparseBuf()` using callback functions.

   - Register the callback functions.

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:

- `xmlinit() - xmlparse()` or

  `xmlparsebuf() - xmlterm()`

- `xmlinit() - xmlparse()` or

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

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

- `xmlinit() - xmlparse()` or

  `xmlparsebuf() - xmlparse()` or

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

#### Figure 21-1 XML Parser for C Usage

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