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

What XML Technologies Does Oracle Provide?

Now that we understand what the XML family of standards is, what we can do with it, and why it is interesting to apply to database-driven web applications, let’s get an overview of the tools and technologies that Oracle provides to implement Oracle XML applications. Figure 1.11 shows an example of the key Oracle XML components and how they relate to the XML standards we’ve discussed earlier.

Overview of key Oracle technologies for XML

Figure 1-11. Overview of key Oracle technologies for XML

Using the Oracle XML Parser, you can parse XML documents into their infoset, manipulate their contents, and return the modified infoset back into XML format. Using the Oracle XSLT processor, you can transform XML into XML, HTML, or text of another structure. Both the Oracle XML Parser and the Oracle XSLT processor share the common Oracle XPath Engine that enables querying an XML document’s infoset to select interesting subsets of its information. The Oracle XML SQL Utility automates the tasks of producing XML from SQL query results and storing XML documents into tables in the database. Oracle interMedia Text enables indexing and querying of XML documents or document fragments, with rich support for leveraging the structure of the XML in the query criteria. These core components are used by more than 40 of Oracle’s own internal development teams, so their quality, performance, and conformance to W3C standards are very high.

Building on these core Oracle XML technologies, the Oracle XSQL Pages system is an extensible XML publishing framework that makes combining the strengths of SQL, XML, and XSLT a declarative walk in the park. It simplifies the job of assembling XML data pages from multiple sources and transforming their information content for delivery using XSLT. Table 1.1 provides a summary of key Oracle XML technologies and the chapters that cover each one.

Table 1-1. Key Oracle XML Technologies and Chapters That Cover Them

Oracle Technology

Description

Chapter(s)

XML Parser

Parses, constructs, and validates XML documents

5, 6

XPath Engine

Searches in-memory XML documents declaratively

2

XSLT Processor

Transforms XML documents

3, 5, 6, 7, 8, 9, 12, 14, 16, 17

XML SQL Utility

Produces XML from SQL and inserts XML into tables

5, 6, 11, 12

XSQL Pages

Assembles XML data declaratively and publishes with XSLT

3, 8, 12, 15, 17

interMedia Text

Indexes and searches XML documents using their structure

13

Object views

Serve rich XML-enabled views of flat relational data

12

JServer Java VM[a]

Reduces network traffic by running Java in the database

6

JDeveloper

Creates, syntax-checks, and debugs Java, XML, XSLT, and XSQL

4, 6

Advanced Queuing

Queues and dequeues XML messages

5, 6

PLSXML utilities

Produce XML datagrams in Oracle7

10

[a] In Oracle8i Release 3, JServer has been renamed Oracle8i JVM.

In the sections that follow, I will summarize the Oracle XML tools and technologies described in this book, noting which chapters describe them and which Oracle releases support them. Many of these Oracle technologies are installed as part of the JDeveloper 3.1 development environment, which comes on the CD-ROM that accompanies this book; I’ll note which technologies are included in JDeveloper 3.1 and give their version numbers.

Note

By the time you read this book, updated releases of some of these components may be available. It’s best to check for the latest versions on the Oracle Technology Network (OTN) at http://technet.oracle.com/software, where all of the technologies described here, including the Oracle8i database, are available for download.

You will need to sign up for a free OTN membership before getting to the download page. See the OTN web page for details.

Oracle XML Parser

The Oracle XML Parser fully supports the W3C XML 1.0 Recommendation as well as the Document Object Model (DOM) for processing and constructing XML. Using its companion support for the Simple API for XML (SAX), you can process XML datagrams of arbitrary size with low memory usage. Using the supplied oraxml tool, you can parse and validate XML files from the command line or in scripts. The parser supports integrated XPath searching on in-memory XML documents using the integrated Oracle XPath Engine, an embedded component shared by the Oracle XML Parser and the Oracle XSLT processor. The Oracle XPath Engine fully supports the W3C XPath 1.0 Recommendation.

I cover all of the key XML Parser capabilities, both inside and outside the database, in Chapter 5, and Chapter 6. We’ll learn about using XPath expressions in Chapter 2, and we’ll use them throughout the book in our XSLT transformations.

The Oracle XML Parser is available for Java, PL/SQL, and C/C++ on all popular platforms. The Java, C, and C++ versions can run outside the database, but exploiting the PL/SQL and Java versions inside the database requires Oracle8i. Version 2.0.2.7 of the Oracle XML Parser for Java is included with JDeveloper 3.1 on the CD-ROM.

Oracle XSLT Processor

The Oracle XSLT processor fully supports the W3C XSLT 1.0 Recommendation. Using the supplied oraxsl tool, you can perform XSLT transformations on XML files from the command line or in scripts. Of course, you can also use the XSLT processor in your own programs.

I cover extensive examples of XSLT in Chapter 3, Chapter 5, Chapter 6, Chapter 7, Chapter 8, Chapter 9, Chapter 12, Chapter 14, Chapter 16 and Chapter 17

You can use the Oracle XSLT processor both inside the database using PL/SQL or Java, and outside the database using Java, C, or C++. Using the processor inside the database requires Oracle8i. Version 2.0.2.7 of the Oracle XSLT processor for Java is included with JDeveloper 3.1 on the CD-ROM.

Oracle XML SQL Utility

The Oracle XML SQL Utility provides a rich layer of services to work with the results of SQL statements as XML documents and to process incoming XML documents for inserting their information into database tables, views, and object views.

I explore using the Oracle XML SQL Utility in PL/SQL in Chapter 5, and using it in Java in Chapter 6, Chapter 11, and Chapter 12.

The Oracle XML SQL Utility can be used outside the database in any Java program, or inside the database in Oracle8i. Version 1.1 of the XML SQL Utility is included with JDeveloper 3.1 on the CD-ROM.

Oracle XSQL Pages XML Publishing Framework

Using declarative templates called XSQL pages , you can assemble any kind of dynamic XML information and transform it for delivery using XSLT stylesheets, as illustrated in Figure 1.12. The Oracle XSQL Pages framework includes an XML template processing engine called the XSQL page processor. This processor manages the assembly of XML fragments based on SQL queries and external XML resources and coordinates transformation of the assembled data page using the Oracle XSLT processor. Also included as part of the framework are the XSQL Servlet, for web-based publishing of XSQL pages, and the XSQL command-line utility for offline batch publishing.

Oracle XSQL Pages framework simplifies XML publishing

Figure 1-12. Oracle XSQL Pages framework simplifies XML publishing

You’ll see a preview of using XSQL Pages in 3, and learn how to use it in Chapter 8, Chapter 12, Chapter 15 and Chapter 17.

Oracle XSQL Pages works against any version of Oracle and can run outside the database on your favorite servlet engine (Apache JServ, JRun, ServletExec, Tomcat, and so on) as well as inside the database on the Oracle Servlet Engine in Oracle8i Release 3 (version 8.1.7). Version 1.0.0.0 of Oracle XSQL Pages comes preinstalled with Oracle Internet Application Server 1.0, Oracle8i Release 3, and is installed with JDeveloper 3.1 on the CD-ROM that accompanies this book.

Oracle8 XML-Enabled Object Views

Leveraging Oracle’s investment in object-relational technology, object views defined over relational data provide a powerful technique to superimpose one or more richly structured, logical views on top of your existing database data. Data queried from object views can be automatically rendered as XML documents, and XML documents can be inserted automatically into the database using object views of an appropriate structure.

You’ll learn how to define and use object views for XML in Chapter 12. You can exploit this feature outside the database using any version of Oracle8, but using it inside the database requires Oracle8i.

Oracle8i JServer Java Virtual Machine

Java and PL/SQL are now peer languages for the Oracle8i database. Any standard Java and JDBC™ code can execute in the same process as the database server, reducing network traffic of data-centric Java code. PL/SQL and Java can interoperate using Java stored procedures.

You’ll learn the ins and out of developing, deploying, and debugging Java-based XML application code with JServer in Chapter 6. JServer is an integrated feature of Oracle8i.

Oracle interMedia

Using interMedia’s Text component’s XML document indexing, you can perform queries over millions of XML documents, leveraging the structure of the XML document for razor-sharp search precision. XML document searching is fully integrated with Oracle SQL, so you can easily exploit it in combination with other SQL query predicates to find your “needle” in a “haystack” of XML documents.

You’ll learn how to create XML indexes and use XML searching in Chapter 13.

XML searching with interMedia Text is available only in Oracle8i, and Oracle8i Release 2 or later is recommended because of the many functional improvements over Release 1 in this area.

Oracle JDeveloper IDE

With its built-in support for color-coded XML editing, indenting, and syntax checking, the JDeveloper Integrated Development Environment (IDE) makes common XML development tasks easier. Its native support for running servlets, XSQL Pages, and JavaServer™ Pages, combined with robust remote debugging support for Apache JServ, Tomcat, and JServer, makes a big difference in development productivity.

You’ll learn how to use JDeveloper for XML development in Chapter 4 and Chapter 6.

JDeveloper 3.1 can be used to work with Java, XML, and Oracle with any database version, but Java stored procedures and JServer debugging are only relevant when using it with Oracle8i. JDeveloper 3.1 can be installed from the CD-ROM accompanying this book on any Windows NT or Windows 2000 machine.

Oracle Advanced Queuing

Oracle’s persistent queuing mechanism is perfect for asynchronously processing XML messages. I cover both PL/SQL and Java techniques for enqueuing and dequeuing XML messages in Chapter 5 and Chapter 6.

Advanced queues are available in any version of Oracle8 and can be used with Java APIs outside the database; however, dequeuing, parsing, and searching XML messages inside the database require Oracle8i.

Oracle PLSXML Utilities

Implemented in PL/SQL, the PLSXML utilities (including the DBXML package) are available to customers using Oracle7 or Oracle8 to automatically produce XML from SQL statements. While the Oracle XML Parser and the XML SQL Utility have superseded the functionality provided by these utilities, using these new components inside the database requires Oracle8i.

We explore using the PLSXML utilities in Chapter 10. Because they consist of pure PL/SQL, the PLSXML utilities work with any current production version of Oracle.

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