O'Reilly logo

Building Oracle XML Applications by Steve Muench

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Source Code for the XML Helper Packages

The xml, xmldoc, xpath, and xslt packages depend on having the Oracle XML Parser for PL/SQL installed. (See Chapter 5 for installation details). In addition, since the Oracle XML Parser for PL/SQL wraps the Oracle XML Parser for Java, one of the following must be true before you can successfully compile and run these packages:

  • You must have already:

    • Installed the Oracle XML Parser for Java in your schema

    • Installed the Oracle XML Parser for PL/SQL packages in your schema, and

    • Been granted the JAVAUSERPRIV privilege to execute Java code inside Oracle8i

  • Alternatively, you must have been granted EXECUTE permission on the Oracle XML Parser for PL/SQL packages installed in another schema.

The xml Package

The xml package provides key functionality for parsing XML documents from VARCHAR2, CLOB, BFILE, and URL sources. It uses the Oracle XML Parser for PL/SQL’s xmlparser package. To use these routines, perform these steps:

  1. Call one of the xml.parse functions to parse your XML document

  2. Work with the returned xmldom.DOMDocument

  3. Call xml.freeDocument( yourDoc ) to free the memory used by the parsed representation of your XML document

It is safe to cache the instances of xmldom.DOMDocument in PL/SQL package-level variables for parsed XML documents you need to use over and over during the same database session, but remember that the memory they occupy is not freed until you explicitly call xml.freeDocument.

Note that if you need to parse an XML document from a ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required