A pragmatic approach to IETMs for medium sized projects within the NATO Maintenance and Supply Agency (NAMSA)   Table of contents   Indexes   Do we need DTDs?

 

XML-Enabling Enterprise Databases to Simplify Internet Applications

 Steve   Muench
  Lead XML Evangelist
  Oracle Corporation  500 Oracle Parkway
Redwood Shores   California  USA  94065
Phone: +1 650 506 7000
Fax: +1 650 506 7433
Email: smuench@oracle.com Web: www.oracle.com/xml
 
Biographical notice:
 
Steve Muench is Oracle's key XML Evangelist. In his nine years at Oracle, he's been involved in the support, development, and evangelism of Oracle's application development tools and database. Steve has been a driving force in helping development teams from the database server, to application server, to tools, to packaged applications weave XML sensibly into their future development plans. Steve works on Oracle's Java Business Objects development team combining XML and Java to build flexible business components.
 
ABSTRACT:
 
To stay ahead of their competition, leading companies in the Information Economy will need to cleverly exploit the synergy of Electronic Commerce, Data Warehousing, Content Management, and Back Office Integration to do better business and do business better over the Web.
 
Building the Internet applications that drive these businesses is hard. Developers are looking for a technology which makes it dramatically easier to acquire, integrate, repurpose, and exchange anyinformation with any partner over the Internet to make their ever-expanding enterprise databases work even harder to their strategic advantage.
 
XML is the technology that will make these applications easier to build and Oracle is tightly integrating XML with its industry-leading database to make them scale reliably to the demands of the Internet.
 

Introduction

 
Internet-empowered consumers and businesses are driving a skyrocketing demand for access to information.
  •  Consumers -- seduced by the convenience of paying bills, booking flights, tracking stocks, checking prices, and getting everything from gifts to groceries online -- are hungry for more.
  •  Businesses -- compelled by the lower costs of online "outsourcing" and the ability to inquire, day or night, "What's the status?" -- are ramping up to reap the rewards.
  •  "Infomediaries" -- inspired by the boundless creative opportunities to aggregate information and broker services between consumers and businesses-- are popping up left and right.
 
In this environment, above all else, winning companies will distinguish themselves by their superior ability to manage information and exploit it to their strategic advantage.
 
Among the list of "winners" so far -- from Amazon.com to Yahoo! -- a recent Collaborative Research survey revealed that 69% of the world's top Web sites are using Oracle technology. However, even with a full-featured, high-performance database at the heart of their Internet architectures, these best-of-breed ECommerce sites claim their key development challenges remain:
  •  Integration with Back-end ERP and EDI systems, inside and outside their companies, and
  •  Integration with Data Warehousing, for unprecedented levels of personalized marketing and content
 
Developers are looking for a technology which makes it dramatically easier to acquire, integrate, repurpose, and exchange information to make their growing databases work even harder on their behalf in this Internet environment. This whitepaper describes how XML, coupled with the existing strengths of the Oracle database, is precisely that technology, and details Oracle's XML Strategy for Oracle8i and beyond.
 

What is XML?

 
XML, the Extensible Markup Language, defines a universal standard for electronically exchanging data. XML specifies a rigorous, text-based way to represent the structure inherent in data so that it can be authored and interpreted unambiguously. Its simple, tag-based approach leverages developers' familiarity of HTML but provides a flexible, extensible mechanism that can handle the gamut of "digital assets" from highly structured database records to unstructured documents and everything in between.
 
An example always makes things clearer. Consider the HTML in FigureMUE-001 that uses tags to present data in a row of a table. Is "Java Programming" the name of a book? A university course? A job skill? You cannot be sure by looking at the data and tags on the page. Imagine a computer program trying to figure it out!

<HTML>
<BODY>
<TABLE>
<TR>
<TD>Java Programming</TD>
<TD>EECS</TD>
<TD>Paul Thompson</TD>
<TD>Ron<BR>Uma<BR>Lindsay</TD>
</TR>
</TABLE>
</BODY>
</HTML>


Simple HTML Page

 
 
Now look at the analogous XML example in FigureMUE-002 . It's the exactly same data, but the tags indicate what information the data represents, not how it should be displayed. It's clear to you and a computer that "Java Programming" is the Name of a Course, but it says nothing about how it should be displayed.

<?xml
version="1.0"?>
<Course>
<Name>Java Programming</Name>
<Department>EECS</Department>
<Teacher>
<Name>Paul Thompson</Name>
</Teacher>
<Student>
<Name>Ron</Name>
</Student>
<Student>
<Name>Uma</Name>
</Student>
<Student>
<Name>Lindsay</Name>
</Student>
</Course>


Simple XML Page

 
 
So XML and HTML each does one job and does it well: XML represents information content, while HTML represents the presentation of that content.
 

An Open, Internet Standard

 
XML is not just a clever way of tagging data. It is a clever, Internet Standard way of tagging data. As a web-centric subset of the well-respected SGML standard, XML is based on a proven technology with a good track record. The Worldwide Web Consortium (W3C) recommended the XML 1.0 standard in February, 1998, and it is being widely and rapidly adopted as a standard for document and data exchange in a variety of markets. XML is gaining wide industry support as well from vendors like Oracle, IBM, Sun, Microsoft, Netscape, SAP and others, as a platform- and application-neutral format for exchanging information.
 
Beyond simply supporting the XML standard, Oracle has begun to participate actively in steering the standards to directly influence the evolution of XML. Bringing its deep technical experience from over 20 years as a database leader, Oracle's hands-on involvement in the current and future XML standards efforts will benefit the Internet development community as a whole. At present, Oracle is working together with IBM, Microsoft, and others in the W3C XML Working Group to define an Internet Standard for "XML Schemas". This effort will create a standard to describe the structure and datatypes of a document's elements to enable more automated and seamless integration of XML with databases and programming languages in the future.
 

Why Does Oracle Care About XML?

 
Oracle customers like those surveyed above need their data to work even harder for them on the Internet. They have told us loud and clear about their plans to cleverly exploit the synergy of Electronic Commerce, Data Warehousing, Content Management, and Back Office Integration to stay ahead of their competition. They see a tantalizing "feedback loop" of online transactions flowing into data warehouses whose "business intelligence" drives "interactive marketing" using personalized content to entice customers to make more online transactions. A memorable comment from one developer we talked to was, "You can tell a lot about someone by what books they buy..."


Portal to a World of Data

 
 
Many see tremendous opportunities for new revenue as "infomediaries", offering a "one-stop-shop" that intelligently links customers to products and services from numerous trading partners. These partnerships can be very dynamic, so infomediaries must aggregate information from partners and integrate with their Back Office systems over the Internet. One of many concrete examples that this phenomenon is beginning to pick up steam is www.priceline.com. Priceline lets you name the price you want to pay for airline tickets, hotel rooms, or new cars. Then, their application attempts to "negotiate" a deal for you with the back-end systems of various trading partners. You pay what you think is a fair price, they make the difference if they can find it any cheaper...
 
These companies have confirmed that efficiently and robustly marrying XML -- the Internet's new standard for information exchange -- with Oracle -- the Internet's leading solution for information management -- is very compelling to them. Oracle cares a lot about XML: it makes every Oracle database more valuable to these customers, and for all the others who will soon follow their lead.
 

Oracle's XML Strategy

 
Oracle's XML strategy is simple:
 
Deliver the best platform for developers to productively build and cost-effectively deploy reliable and scalable Internet applications exploiting XML
 
The implementation of this strategy will be delivered to developers in phases beginning with the release of Oracle8i. In Oracle8i developers will get Core XML support built in Java and running on the Oracle8i Platform for Java. Additional XML capabilities up and down the Oracle technology stack, from database to app server to tools to packaged Applications, will build on this core set of facilities.
 

Oracle8i Platform for Java

 
Oracle8i adds a fully-compliant, JDK 1.1.6-compatible Java VM to the database server. It was written from scratch to be optimized for running in a highly scalable server environment. Oracle8i ships with an implementation of JDBC that makes any database access performed by Java code executing in the database lightning fast. The Oracle8i Java VM and anything running on it works on any platform where Oracle8i runs.


Oracle8i Platform for Java/XML

 
 
Running on top of the Oracle8i Java VM are a set of platform services supporting industry-standard interfaces for developers to build robust, database-driven applications in Java and PL/SQL. These services include:
  •  Java Stored Procedures for integrating Java code with SQL and PL/SQL
  •  Object Request Broker based on VisiBroker for Java for distributed object communications
  •  Enterprise JavaBeans 1.0 Server for server-based transactional components
  •  Web Server to enable invoking Java Servlets running in the database from a browser over HTTP
  •  Internet File System (iFS) for organizing and accessing documents and data using a file/folder-based metaphor through standard Windows & Internet protocols (SMB, HTTP, FTP, SMTP, POP, IMAP)
 
Using these "ingredients", developers can custom-"bake" compelling Internet solutions that integrate Java and database data and facilities in any way they need to. This means it is straightforward to use your favorite Java-based XML technology if you prefer it to ours. However, don't make up your mind on that until you read the next section...
 

Core XML Support in Oracle8i

 
For XML-powered Internet application development and deployment, Oracle8i will feature a set of Core XML Support offering the following unique benefits:
  1.  Makes developers more productive by
    •  Simplifying the tight integration of XML with database data
    •  Extending the power of database queries to XML documents
  2.  Makes applications more scalable by
    •  Processing database data and XML together in the same server, eliminating network traffic for data access
    •  Exploiting the speed of the Oracle8i's query engine and server-optimized Java VM
  3.  Makes applications more cost-effective to deploy by
    •  Providing a reliable, scalable, and manageable server platform supporting industry standards
    •  Running on your current and future hardware from NT & Linux boxes to parallel clusters of mainframe-class machines
 
The Oracle8i Core XML Support comprises three key facilities:
  •  Oracle XML Parser, for programmatic processing of XML documents or document fragments
  •  XML Support in iFS to automate parsing and rendering of data between XML and the database
  •  XML-enabled "section searching" in ConText for more precise searches over structured documents
 

Oracle XML Parser

 
Since the Oracle XML Parser is implemented in Java, it can run "out of the box" on the Oracle8i Java VM. It supports the XML 1.0 specification, with the goal being that it be 100% fully conformant, and can be used both as a validating or non-validating parser. In addition, it provides the two most common API's developers need for processing XML documents:
  •  The W3C-recommended Document Object Model (DOM)
  •  The de facto standard Simple API for XML (SAX) interface.
 
This makes writing custom applications that process XML documents straightforward in the Oracle8i environment, and means that a standards-compliant XML parser is part of the Oracle8i platform on every operating system where Oracle8i is ported. On top of its native Java implementation, the Oracle XML Parser is planned to feature a PL/SQL interface as well. This means Oracle shops familiar with PL/SQL will be able to extend existing applications to take advantage of XML as needed.
 

XML-Based File Types in Oracle iFS

 
The Oracle Internet File System (iFS) supports an extensible way to define new file types and provides built-in support for defining, parsing, and rendering file types that are XML documents. When registering an XML-based file type, you supply a document descriptor that specifies your file type's XML document structure and how it should be stored in the database. Oracle iFS document descriptors use an XML-based syntax to describe the structure (or "schema") of its XML-based file types. When a file is saved or sent to iFS, it recognizes the document as one of your file types, parses its XML, and stores the data in tables as you have indicated in the document descriptor. The same information is used to render (i.e. reassemble for delivery) the XML document when a particular instance of your filetype is requested through any of iFS' supported protocols.
 
You can indicate that highly structured XML documents be stored into and rendered from a series of related database tables and columns, or choose to have the entire XML file stored in a "text blob". For documents that mix structured data and structured text markup, you can combine the two approaches. For example, a "PurchaseOrder" filetype may map to POHeader and POLines tables, while an "InsuranceClaim" file type -- which mixes structured text markup for a Damage Report with structured data about Settlement Payments -- would opt to store the data in tables and the structured markup as document fragments in text blobs. FigureMUE-005 shows the contents of a sample InsuranceClaim.

<?xml
version="1.0"?>
<InsuranceClaim>
<ClaimID>12345</ClaimID>
<LossCategory>7</LossCategory>
<Settlements>
<Payment>
<Payee>Borden Real
Estate</Payee>
<Date>12-OCT-1998</Date>
<Amount>200000</Amount>
<Approver>JCOX</Approver>
</Payment>
</Settlements>
<DamageReport>
A massive <Cause>Fire</Cause> ravaged
the building and
<Casualties>12</Casualties>
people were killed. Early
FBI reports indicate that
<Motive>arson</Motive> is
suspected.
</DamageReport>
:
</InsuranceClaim>


Insurance Claim Mixes Structured Data and Text

 
 
Once instances of iFS file types (including XML-based ones) are stored in the database, their content can be searched using standard SQL queries, and these files can be organized, browsed, and versioned using familiar tools like the Windows Explorer. So an insurance agent sees a directory of InsuranceClaim files she's recently worked on in the field, while an InsuranceClaim-processing application developer can work with the information in the InsuranceClaim in any way he needs to.
 

XML-Enabled "Section Searches" in ConText

 
Any XML documents or document fragments saved into "text blobs" in the database can be enabled for indexing by Oracle8i InterMedia's ConText text-search engine. ConText has been enhanced for Oracle8i to allow developers to pinpoint their searches to a particular section of a document, where sections are implicitly defined by the XML tags in the document (fragment). Since ConText is seamlessly integrated into the database and the SQL language, developers can use SQL to perform queries that involve both structured data and indexed document fragments. For example, FigureMUE-006 shows the SQL statement you would write to search one million Insurance Claims in your database to answer the question, "How much money has Jim Cox approved to date in settlement payments for arson-related fire claims? "

SELECT SUM(Amount)
FROM Claim_Header ch,
Claim_Settlements cs,
Claim_Settlement_Payments csp
WHERE csp.Approver = 'JCOX'
AND CONTAINS (DamageReport, 'Arson
WITHIN Motive') > 0
AND CONTAINS (DamageReport, 'Fire
WITHIN Cause'  ) > 0
AND . . . /* Join Clauses */


Searching on a Column & Text in XML Sections

 
 
Try that with text files on a hard drive! This example shows how the information in XML-based InsuranceClaims can be searched and manipulated very powerfully using capabilities familiar to database-savvy developers once it is stored in an Oracle8i database.
 

How Companies Will Use Oracle8i & XML

 
To formulate our XML strategy and implementation plans, we interviewed numerous architects and developers at customer sites who plan to be early adopters of XML. These customers have clear ideas about how they want XML and their database to work closely together to facilitate the acquisition, integration, repurposing, or exchange of data. Here are brief overviews of some of the cases we've learned about.
 

Uniting the World of Collectible Books

 
Before the Internet, book collectors sought out their "treasures" by visiting quiet stores one at a time or by requesting hand-printed catalogs from booksellers by mail. Today web sites allow collectors to search the catalogs of hundreds of small bookstores worldwide from a single screen. One giant step for collectors to be sure, but a giant headache for the staff working to keep this virtual "consignment table" of rare books up to date. The last thing these popular sites want to do is disappoint customers when the book they thought was available was sold two weeks ago in the shop on 84 Charing Cross Road.
 
Using Oracle8i, they can register an XML-based BookCatalog file type with iFS. The BookCatalog will use a small set of XML tags describing the key aspects of a collectible book -- Author, Title, Publisher, DatePublished, Edition, DustJacketCondition, Price. Then, they will ask each bookstore to be responsible for making its own BookCatalog file available to the virtual bookstore. Since the format of the BookCatalog file is XML and since XML is just text, some shops will simply edit and email a text file full of XML tags to fulfill their side of the bargain. Others, whose inventory is still kept in ancient DOS-based DBF files, will pay a local programmer to write a Perl program for their Apache web server to format the DBF data in XML on request. For stores with an Oracle database and a web server, the virtual store can send an HTTP request to search their catalog in real time, again expecting only that the results resemble an XML-formatted BookCatalog file type. This way the virtual store is as up to date as the individual booksellers can each support. Since iFS allows XML-based file types to be manipulated through virtually any industry-standard protocol, handling email submission or HTTP request of BookCatalogs will be easy.
 

Exploiting the Latest & Greatest Dynamic HTML UI's

 
Many companies have been closely following announcements from Microsoft and Netscape about the XML capabilities in their next-generation browsers. Using Internet Explorer 4.0 or 5.0's built-in XML parser, they have prototyped building very "thin", highly dynamic user interfaces leveraging Dynamic HTML. To eliminate trips to the web server and avoid refreshing the entire browser page on each request, these developers use JavaScript to request new XML "datagrams" from the middle-tier via HTTP. The browser's built-in XML parser receives the stream of tagged data from the middle-tier and exposes the Document Object Model interface on the resulting "tree of data" so that the developers' JavaScript can inspect what data has "arrived" and update the UI to reflect any changes.
 
Imagine a Dynamic HTML UI for managing stock portfolios. In the first request to the web server, the initial DHTML page is returned along with an embedded XML document fragment describing the positions in the current user's portfolio, current price quotes for those positions, and any related links to news stories about those positions. This XML fragment provides all the initial data needed by the application to allow the user to sort and search and chart his portfolio from various points of view without going back to the server to refresh the page display. When the user clicks on the button to request 3 months of historical price quotes for a given stock, its high, low, and close numbers for last three months can be returned in single XML "datagram" from the middle-tier and be processed by the JavaScript code in the page. FigureMUE-007 shows the JavaScript syntax in Internet Explorer 5.0 that a developer would write to request and parse it. The syntax to navigate the "tree" of historical quote data is the W3C standard Document Object Model (DOM) API in both Netscape 5.0 and Internet Explorer 5.0.

// JavaScript in IE 5.0 to
load & parse
// XML document from URL

var xml = new ActiveXObject("Microsoft.XMLDOM");
xml.load("http://zTrade.com/GetQuotes?sym=ORCL&mon=3");
var docroot = xml.documentElement;

// Use DOM API to walk the XML "Tree" of historical
// quote data starting with "docroot"


JavaScript to Request & Parse an XML "Datagram"

 
 
Some of these companies had already begun to experiment with emerging browser support for applying CSS Style Sheets to XML documents to define the "presentation characteristics" for the XML-tagged data sent to the browser. Many were closely following the evolving W3C proposals for the Extensible Stylesheet Language (XSL) which will offer an Internet Standard, XML-based syntax to describe transformations on the structure of an XML document. Their keen interest in XSL was rooted in their interest in a special case of that facility -- transforming XML into HTML for presentation -- for personalized delivery and filtering.
 
These companies will use Oracle8i's Java Servlets and JDBC support to write custom, data-driven XML generation "services" which their DHTML browser apps will leverage via HTTP. They want to later experiment with iFS or combine Servlets with the Oracle XML Parser to post updates back to the server. They have Solaris, Linux, and NT servers, so they are counting on Oracle8i's portability.
 

"Wandering" the Web More Intelligently

 
Netscape recently launched its Netscape Communicator 4.5 with a widely-praised new feature called "What's Related." While viewing any page on the Web, an instant list of related sites is one mouse-click away. If you have tried the innovative feature yourself, you may have wondered, "How does the browser know what sites are related to the current page?" You probably didn't guess that the answer is XML.
 
When a user clicks on the "What's Related" button, Communicator sends an HTTP request to a What's Related service running on one of Netscape's web servers. The service accepts the URL of your current web page and returns an XML-document with the set of related sites to be displayed in your browser. For example, FigureMUE-008 shows the XML document sent back to the browser from the Netscape What's Related server when asked for sites related to http://www.etoys.com, an Internet toystore.

<RDF:RDF>
<RelatedLinks>
<child href="http://www.faoschwarz.com/"
name="FAO"/>
<child href="http://www.galoob.com/"
name="Galoob Toys"/>
<child href="http://www.toysrus.com/"
name="Toys -R- Us"/>
<child href="http://www.barbie.com/"
name="Barbie's Website"/>
<child href="http://store.disney.com/"
name="Disney Store Online"/>
</RelatedLinks>
</RDF:RDF>


XML Returned by Netscape's "What's Related" Service

 
 
The results returned by the What's Related service are based on a search of Alexa Internet's gigantic database of web site relationships which is kept up to date using a combination of crawling, archiving, and data mining techniques. While the data returned in Figure 8 is deceptively simple, it illustrates two important points that early-adopters of Oracle8i's XML support will find very compelling:
  •  Any client capable of sending an HTTP request and parsing XML output can take advantage of an XML-based Internet service (like What's Related)
  •  Any server capable of responding to an HTTP request and returning an appropriately-formatted XML output can be easily "plugged in" as an alternate implementation of an Internet service
 
For example, in the future Netscape could offer other vendors a chance to provide alternative "What's Related" services by simply allowing the end-user to select his favorite What's Related server in his browser preferences. In its implementation, each server might offer a different approach to deciding what's "related", but all would agree on the XML format of the suggestions they returned. Using Oracle8i's XML support, developers will find it highly productive and cost-effective build these highly-scalable, database-driven Internet information services.
 

Managing the Production Cycle for "Media Assets"

 
A major telecommunications firm explained their plans to automate the production and delivery of media assets like web graphics, photos, line art, sketches, video clips, etc. They have prototyped a Web-based service allowing companies like magazines, TV shows, web site developers, and advertising firms to interact online with the artists who they commission to produce media content. Managing the media production lifecycle requires precisely capturing and subsequently validating the specifications for the media content the requester has commissioned from the artists. In response to the proposed specifications, artists provide time estimates for delivery that the system must also capture so the process can be scheduled to meet deadlines. They want all of this information about the media content to be exchanged as XML-based metadata.
 
They already use Oracle8 to store and search images and video, and looking forward to Oracle8i's core XML support to store and query the media's XML-based metadata in scalable way as well. Since the metadata for access rights, royalties, and the initial specifications are structured text markup, they will leverage both SQL queries and ConText's XML Section Searching as they prototype additional lucrative opportunities for delivering personalized content from their online media "warehouse" to paying subscribers.
 

Further Customizing "Custom News"

 
Oracle and CNN joined forces in 1997 to develop and launch a Web-based news service called CNN Custom News. The database-driven site took personalization to a new level by delivering a "personal newspage" to each user with just the news, financial data, sports, and weather stories they wanted to see. The joint development team used Oracle Application Server and the Oracle database's advanced text and thematic searching to accomplish this feat. Today, this kind of personalized content delivery has become "tablestakes" for any site hoping for loyal return visitors.
 
With XML-based industry standards brewing for the exchange of media content and the team's desire to offer even richer kinds of personalization features on the site, they are acutely interested in Oracle8i's scalable, database-centric XML integration. With Oracle8i's core XML support, they could receive XML-based news feeds efficiently and search them more intelligently based on the structured markup in each story. Like the Dynamic HTML developers above, the CustomNews team is evaluating the Extensible Stylesheet Language (XSL) for transforming news content into HTML presentation, but with a dynamic twist. Since XSL uses an XML-based syntax, the team could use PL/SQL or Java to dynamically generate XSL stylesheets for each user based on individual preferences stored in database tables. This technique should enable them to offer not only personalized content, but customized presentation as well. In the future, each user would see just the information they need in the visual presentation they find most useful.
 

Simplifying the Online Shopping Experience

 
The Web Procurement team in Oracle Applications is using XML to deliver a more integrated online purchasing experience. While a user is completing a new purchase requisition for new hardware, she'll be able to go directly to the computer manufacturer's web site to browse the latest models, specs, configuration options, and negotiated prices. Web Procurement sends along a purchase requisition reference number and some authentication information to the partner's web site.
 
At the partner site, the user adds items to her shopping basket, then clicks on a button to indicate that she is done shopping. The partner sends back the contents of the shopping basket to the Web Procurement application as an XML file containing the part numbers, quantities, and prices that the user has chosen. The items from the "shopping basket" are automatically added to the new purchase requisition as line items. The Web Procurement team use the Oracle XML Parser, Java Servlets, and custom Java code for authenticating the "Shopping Cart" it receives from partner web sites.
 

Keeping up with Mergers and Acquisitions

 
The developers at one company had just completed their second acquisition in the last year and a half. They needed to integrate the newly acquired company's SAP Human Resources with their production Oracle Financials. They were looking into using a 3rd-party solution like webMethods' "B2B for R/3" which provides XML-based integration for SAP R/3 to help with part of the solution. They want to enhance their custom Oracle Financials screens to queue up integration messages to the SAP R/3 system, using Oracle8 Advanced Queuing (AQ). With Oracle8i they will be able to write Java Stored Procedures that dequeue these asynchronous messages, then format and forward the appropriate XML-messages to "B2B for R/3" via HTTPS. In the reverse direction, they are looking to use Java Servlets and the Oracle XML Parser to receive integration messages from "B2B for R/3" and enqueue appropriate integration messages to the Oracle Financials system which will call routines they've already implemented in PL/SQL.
 

Do I Have to Wait for Oracle8i?

 
While Oracle8i will make building database-enabled XML applications much easier, some developers have begun prototyping in Oracle7 and Oracle8 using Java outside the database and PL/SQL inside the database. Oracle developers familiar with PL/SQL and Oracle AppServer's PL/SQL Agent will find generating XML from stored procedures to be as easy as generating database-driven HTML pages. In fact, the only difference between generating XML and HTML is the text that you print out "around" the data that your stored procedures access. FigureMUE-009 shows a simple PL/SQL stored procedure that accepts one parameter as the search criterion for the name of a Department, and returns an XML document to the requester containing the Department information for all of the matching rows.

CREATE PROCEDURE FindDepts(
theName VARCHAR2) IS
BEGIN
---------------------------------------------
-- Return an XML document to the requester --
-- containing all Departments whose names  --
-- match the string passed-in.
--
-- Uses PL/SQL Agent's HTP.P() to print    --
-- to the http request Output Stream       --
---------------------------------------------
htp.p('<?xml version="1.0" ?>');
htp.p('<DepartmentList>');
FOR r IN (SELECT *
FROM dept
WHERE dname LIKE
'%'||theName||'%')
LOOP
htp.p('<Department>');
htp.p( '<ID>'||
r.deptno||'</ID>');
htp.p( '<Name>'||
r.dname ||'</Name>');
htp.p('<Location>'||
r.loc ||'</Location>');
htp.p('</Department>');
END LOOP;
htp.p('</DepartmentList>');
END;


PL/SQL to Return Departments in XML

 
 
The requesting program could be a Dynamic HTML page using JavaScript to request a "datagram" from the middle-tier. It could be a middle-tier program needing the assistance of this PL/SQL Departments lookup "service." In either case, the stream of data is delivered to the requester who then parses it to discover its content. If the requesting program happens to be an XML viewing/editing tool, then what it does after parsing the document is to display its structure in a tree.


Viewing XML Result

 
 
FigureMUE-010 shows the result of using a 3rd-party XML editor to "open" the URL:
 
http://mybox.com/myagent/owa/FindDepts?theName=H
 
Through the magic of the PL/SQL Agent, this URL request is translated into an invocation of the stored procedure above, and the XML document it generates on the fly is returned to the requesting program (XML Notepad).
 
The PL/SQL example above is obviously hard-coded for the Dept table. But you can imagine how a more generic PL/SQL routine could be written that would handle formatting SQL query results in XML for any table in your database. As a hint to the reader, recall that the Oracle data dictionary holds queryable information about tables, columns, and referential constraints, and remember that the DBMS_SQL package lets you perform dynamic SQL.
 

Oracle's Future XML Initiatives

 
Oracle is making a major commitment to XML, and the Core XML Support being delivered in Oracle8i is a major first step. Oracle will continue to make it even easier to build database-driven Internet applications that exploit XML in future releases of Oracle8i, AppServer, Tools, and packaged Applications. Below are short summaries of the key XML enhancements we're working on for delivery in the future.
 

Returning "Richer" XML Results from SQL Queries

 
By more tightly integrating the SQL3 type system and XML, the database will provide a natural mapping of object/relational SQL query results to a well-formed XML-document. Combining this tighter SQL/XML integration with the current Oracle8 mechanism for defining Object Views over relational data, it will be possible to query a logical view of "Accounts" and return all of the related, supporting information pertinent to that account with a single request to the database.


Simple Schema and a "Logical View" Using Object Views

 
 
By defining an object view for a logical "Account" comprising data from tables in FigureMUE-011 , a query returning these "Accounts" could produce the XML output being browsed in FigureMUE-012 . The output shows one Account, with a list of Positions in the account. For each Position, the related company appears with a list of recent news articles about the company.


Output of a Future Query on "Account"

 
 
You can imagine this "Account" query result being returned to a portfolio-tracking application running in a browser. Since views let you shape the data in any way you like, you could also define a logical "Company" object view over the same tables above, but which returned a result about a single Company and all its related NewsStories and Position-holding Account owners. While this more integrated SQL-to-XML support is coming in a future Oracle8i release, the current Oracle data dictionary makes all the information available for clever programmers to write a PL/SQL or Java program today that could achieve similar results.
 

Querying the Full XML Document Hierarchy

 
Oracle is closely following proposals for an XML Query Language. We intend to work with the members of the XML Working Group including IBM, Microsoft, and others to create a standard that makes sense for our customers. It's critical to us that the proposal map cleanly onto SQL so that query performance can leverage the optimization and scalability work we've done over the last 20 years. Whatever the syntax turns out to be, it will be aimed at allowing the query to more fully address the rich, nested structure of an XML document in the selection and filter criteria.
 

Simplifying the Development of Applications that Process XML

 
In addition to the tighter database integration between SQL query results and XML, Oracle's Tools Division is enabling XML ease-of-use features in products like:
  •  Oracle Developer
  •  Oracle WebDB
  •  Oracle JDeveloper
 
to assist developers in using XML and iFS' XML file type support for reading and writing application data as XML documents.
 
In particular, to aid developers using Java to write custom applications that process XML documents and "datagrams," a future release of Oracle JDeveloper will incorporate wizards to assist in creating these "customized parsing apps" and a structured XML editor for searching, viewing, and editing the contents of XML files.
 

Customizing Reusable Enterprise Business Logic

 
Oracle's forthcoming Java Business Objects (JBO) framework makes Java-based business application logic easy to write, easy to reuse, and easy to customize for the Oracle8i Enterprise JavaBeans environment. It combines the power of a flexible, Java-based framework with extensive use of XML to represent the declarative features of business objects. For many routine customization scenarios, this allows application business logic to be tailored by consultants or MIS staff using their favorite XML editor, instead of requiring code modifications. By initially using iFS -- and ultimately the Oracle Repository -- to store JBO's XML-based business object metadata in the database, it becomes easily queryable to enable impact analysis and to simplify writing dynamic applications.
 

Building Robust, Validated "Business Documents"

 
Oracle iFS allows Java programmers to extend and change its file type parsers and renderers. This makes it possible to write Java code that evaluates simple validation checks whenever a document is parsed. However, if a company has used the forthcoming Java Business Objects (JBO) framework to encapsulate the enterprise business rules for a Purchase Order, for example, we will enable that same business logic to apply to a Purchase Order submitted through XML.
 

Managing and Sharing Tools and Data Warehouse Metadata

 
Oracle is implementing support in the Oracle Repository for the XML Metadata Interchange (XMI) specification proposed by Oracle, IBM, and Unisys. This will enable application development tools and data warehousing tools from Oracle and others to exchange common metadata, insuring that customers can choose a best-of-breed tools approach without losing important application and warehouse design details.
 

Using the Internet for Reliable, Asynchronous Messaging

 
Oracle plans to extend Oracle Advanced Queues (AQ) to allow reliable propagation of asynchronous messages, including messages with XML documents or document fragments as their "payload", over (Secure) HTTP. This will enable dynamic trading relationships between partners to leverage the ubiquity and familiar standards of the Internet as their common messaging "backbone," eliminating unnecessary delays and startup costs to establish links between companies.
 

Replicating Data Over the Internet

 
To further simplify the automatic synchronization of application data in a distributed, Internet environment, Oracle is investing in ways to support HTTP-based data replication and bulk transfer among database servers as well as between data servers and mobile users.
 

Integration of Web Data of All Kinds

 
Today Oracle Gateways integrate tabular information from heterogeneous data servers and applications so that data from multiple sources appear to reside in a single local database. Oracle will extend current gateway technology to handle non-tabular, heterogeneously-structured XML datasources.
 

Integrating Oracle Applications with Other ERP Systems

 
Oracle Applications will provide out-of-the-box XML-based application messaging on top of Oracle Advanced Queues (AQ) for loosely-coupled integration across different Oracle Applications and between Oracle Applications and other ERP solutions.
 

Conclusion

 
Oracle's XML strategy is to deliver the best platform for developers to productively build and cost-effectively deploy reliable and scalable Internet applications exploiting XML. Oracle8i represents a significant "down payment" on the delivery of this strategy, and broad efforts are underway within Oracle to deliver additional XML capabilities up and down our product stack.
 
With its integrated Java & XML support to complement its industry-leading portability, reliability, and scalability, Oracle8i gives developers a leg up in satisfying the increasing demand for access to information. Oracle8i and XML help companies create strategic advantage by dramatically simplifying the acquisition, integration, repurposing, and exchange of information over the Internet. Once that XML-based information is safely stored in an Oracle database, it can be searched and mined and processed and presented in familiar, powerful ways.
 
Most leading Internet companies already have Oracle at the heart of information management architecture for the Web, so the Oracle8i/XML combination is a natural extension to the way they do business today. It provides a compelling technical platform to further profit from opportunities where Electronic Commerce, Data Warehousing, Content Management, and Back Office Integration flow together.
 
We look forward to your feedback on our direction and encourage your involvement in shaping our future plans in this important new area.

A pragmatic approach to IETMs for medium sized projects within the NATO Maintenance and Supply Agency (NAMSA)   Table of contents   Indexes   Do we need DTDs?