Producing and Transforming XML Query Results
In this section, we’ll briefly cover the mechanisms available in Java for producing XML from SQL queries and for transforming XML using XSLT transformations:
The XML SQL Utility provides capabilities to automatically deliver the results of any valid SELECT statement as an XML document.
The Oracle XSLT processor implements an XML transformation engine compliant with the W3C XSLT 1.0 Recommendation (see http://www.w3.org/TR/1999/REC-xslt-19991116) that allows you to transform XML in one format into XML, HTML, or text of another format.
These topics are covered in detail in Chapter 7 and Chapter 9, so here we’ll focus mostly on the basic mechanics of working with the XML SQL Utility and the Oracle XSLT processor. First, we cover the steps required to verify that these facilities are properly installed in your database, and then we’ll present some simple examples of their use.
Installing XML SQL Utility and XSLT Processor
First, check to see if the Oracle XML SQL Utility is already installed in your Oracle8i database by doing the following:
Connect to your Oracle8i database with SQL*Plus:
Check the status of the
oracle.xml.sql.query.OracleXMLQueryclass by running the following SQL statement:
SELECT SUBSTR(dbms_java.longname(object_name),1,35) AS class, status FROM all_objects WHERE object_type = 'JAVA CLASS' AND object_name = dbms_java.shortname('oracle/xml/sql/query/OracleXMLQuery')
You should see the result:
CLASS STATUS ...