Oracle9i Application Developer's Guide - XML Release 1 (9.0.1) Part Number A88894-01 |
|
This chapter describes the following sections:
Appendix A, "An XML Primer", provides some introductory information about XML, the W3C XML recommendations, differences between HTML and XML, and other XML syntax topics. It also discusses reasons why XML, the internet standard for information exchange is such an appropriate and necessary language to use in database applications.
XML models structured and semi-structured data. Oracle9i supports structured and semi-structured data, as well as complex and unstructured data. Oracle9i is XML-enabled in that it natively handles the storage, query, presentation, and manipulation of XML data.
Figure 1-1 shows the Oracle XML components in the "XML application" box. Oracle XML components are comprised of the following:
XMLType
- a new datatype to store, query, and retrieve XML documents
SYS_XMLGEN
- SQL function to create XML documents
SYS_XMLAGG
- SQL function to aggregate multiple XML documents
DBMS_XMLGEN
- a built-in package to create XML from SQL queries
XMLType
and text columns
Figure 1-1 also lists some typical XML-based business solutions:
Figure 1-1 also shows the following:
XSQL Servlet and Pages, Oracle9i Internet File System (9iFS), JDeveloper, Business Components for Java (BC4J), Oracle Portal (WebDB), Oracle9iAS Reports Services, and Oracle9i Dynamic Services can all be used to build XML applications.
XML applications can either reside on the database or on a middle tier, such as Oracle9i Application Server, Apache Server, or other Java enabled Web servers.
Data is stored as relational tables utilizing object views or as XML documents in XMLType
columns and CLOBs. Oracle Text (interMedia Text) can be used to efficiently search XML documents stored in XMLType
or CLOB columns.
XML has emerged as the standard for data interchange on the Web and Oracle9i is XML-enabled to natively store, search, and retrieve XML in the following formats:
You can also use XSU or SQL functions, such as Extract()
, and TABLE
functions, to convert the XML back to its object relational (decomposed) form.
XMLType
or CLOB/BLOB columns and use XMLType
functions such as Extract()
and ExistsNode()
or Oracle Text indexing to search these documents.
Oracle9i provides the following XML support:
In this release, Oracle extends the XML support in the server:
XMLType
stores XML documents as Character Large Objects (CLOBs). Oracle Text (interMedia Text) indexing can then be used to index the XMLType
columns and query them using the CONTAINS
operator and an XPath-like syntax. XMLType also supports member functions that can be used to extract fragments from the XML document.
Oracle9i provides new types to handle XML and URI data. The Extensible Markup Language (XML) is a standard format developed by the World Wide Web Consortium (W3C) for representing structured and un-structured data on the Web.
URIs or Universal Resource Identifiers are used to identify resources such as web pages anywhere on the web. Oracle9i provides a new class of URIs to access data stored in the database itself, called DBUri-refs. It also provides a new set of types to store and access both external and internal URIs from the database.
The Oracle supplied type, XMLType
, can be used to store and query XML data in the database. XMLType
provides member functions to access, extract and query the XML data using XPath expressions. XPath is another standard developed by the W3C committee to traverse XML documents. In Oracle9i, XMLType
functions only support a limited subset of the XPath expressions. Oracle9i also provides a set of SQL functions such as SYS_XMLGEN,SYS_XMLAGG,
and other PL/SQL packages (DBMS_XMLGEN
) to create these XMLType
values from existing relational or object relational data.
XMLType
, a system defined type, can be used as arguments to functions or as table or view columns. When you create a XMLType
column in a table Oracle internally uses a CLOB to actually store the XML data associated with this column. You can create Oracle Text indexing on the XMLType
column and other functional indexes. In Oracle9i, since the XMLType
is stored as a CLOB, updates can only be made to the entire document.
See Also:
|
Oracle9i supplies the following family of Uri types:
These are related by an inheritance hierarchy. UriType
is an abstract type and the DBUriType
and HttpUriType
are subtypes of this type.
HttpUriType
can be used to store URLs to external web pages or files. It accesses these files using the HTTP protocol (Hyper Text Transfer Protocol).
DBUriType
can be used to store DBUri-refs which reference data inside the database.
Since UriType
is the super type, you can create columns of this type and store DBUriType
or HttpUriType
instances in this column. This allows you to reference data stored inside or outside the database and access them consistently.
DBUri-ref uses an XPath like representation to reference data inside the database. If you imagine the database as a XML tree, then you would see the tables, rows and columns as elements in the XML document. For instance, user scott
would see a tree such as:
<SCOTT> <EMP> <ROW> <EMPNO>2100</EMPNO> <ENAME>John</ENAME> <SALARY>10000</SALARY> .. <!-- other columns --> </ROW> ... <!-- other rows --> </EMP> <!-- other tables..--> </SCOTT> <!-- other user schemas on which you have some privilege on..-->
DBUri-ref is simply an XPath expression over this virtual XML document. So to reference the SALARY
value in the EMP
table for the employee with employee number 2100
, you can write a DBUri-ref as:
/SCOTT/EMP/ROW[EMPNO=2100]/SALARY
Using this, you can reference data stored in CLOBs or other columns and expose them as URLs to the external world. Oracle9i provides a standard servlet than can be installed and run under the Oracle Servlet engine which can interpret such URLs.
Oracle's extensibility enables special indexing on XML, including Oracle Text indexes for section searching, special operators to process XML, aggregation of XML, and special optimization of queries involving XML.
XML text stored in LOBs can be indexed using the extensibility indexing interface. Oracle9i provides operators such as CONTAINS
and WITHIN
that you can use to search within the XML text for substring matches.
There are many potential uses of XML in Internet applications. This manual focuses on the following two database-centric application areas where Oracle's XML components are well suited.
Content and document management includes customizing data presentation. These applications typically process mostly authored XML documents. Several case studies are described in the manual.
B2B and B2C messaging involves exchanging data between business applications. These applications typically process generated XML documents or a combination of generated and composed XML documents.
For descriptions of the Oracle XML components and how they work together see Chapter 2, "Modeling and Design Issues for Oracle XML Applications" and Chapter 3, "Oracle XML Developer Kits (XDKs) and Components: Overview and General FAQs".
The remaining sections of this manual, describe how to use the Oracle XML components, Oracle development tools, and how to build Web-based, database applications with these tools.
Oracle9i is well-suited for building XML database applications. Oracle XML-enabled technology has the following features:
Oracle Text (interMedia Text) provides powerful search and retrieval options for XML stored in CLOBs and other documents. It can index and search XML documents and document sections as large as 4 Gigabytes each stored in a column in a table.
Oracle Text XML document searches include hierarchical element containership, doctype discrimination, and searching on XML attributes. These XML document searches can be used in combination with standard SQL query predicates or with other powerful lexical and full-text searching options.
XML documents or document sections saved into text CLOBs in the database can be enabled for indexing by Oracle Text's text-search engine. Developers can pinpoint searches to data within a specific XML hierarchy as well as locate name-value pairs in attributes of XML elements.
Since Oracle Text is seamlessly integrated into the database and the SQL language, developers can easily use SQL to perform queries that involve both structured data and indexed document sections.
Also included in Oracle XML are the following components:
Built from the ground up on Oracle Multi-threaded Server (MTS) architecture, Oracle JVM (Jserver) is a Java 1.2 compliant virtual machine that data server shares memory address space. This allows the following:
Oracle JVM supports native CORBA and EJB standards as well as Java Stored Procedures for easy integration of Java with SQL and PL/SQL.
Oracle9i Application Server (Oracle9iAS), offers services for both intranet and internet Web applications. It is integrated with Oracle9i and offers advanced services such as data caching and Oracle Portal. Oracle9iAS also provides other services including Oracle Advanced Queueing, Oracle Message Broker, Oracle Workflow, Oracle9i Reports Services, Dynamic Services, and more.
A key development challenge is integrating back-end ERP and CRM systems from multiple vendors, with systems from partners in their supply chain, and with customized data warehouses.
Such data exchange between different vendors' relational and object-relational databases is simpler using XML. One example of a data exchange implementation using XML and AQ is provided in Oracle9i Case Studies - XML Applications, "Building a B2B Application Using XML and AQ".
Oracle XML Technology and Oracle XML-enabled tools, interfaces, and servers provide building blocks for most data and application integration challenges.
Not only are these building blocks available, but their use results in higher performance implementations for the following reasons:
Hence developers can build XML-based Web solutions that integrate Java and database data and facilities in many ways.
Oracle XDKs are implemented in four languages, Java, C, C++, and PL/SQL. The Java version runs directly on Oracle JVM (Java virtual machine). It supports the XML 1.0 specification and is used as a validating or non-validating parser.
The parser provides the two most common APIs that developers need for processing XML documents:
For more information, see Chapter 20, "Using XML Parser for Java"". See Appendix B, "Comparing Oracle XML Parsers and Class Generators by Language", for a comparison of the Oracle XML parsers and generators.
Writing custom applications that process XML documents can be simpler in an Oracle9i environment. This enables you to write portable standards-based applications and components in your language of choice that can be deployed on any tier.
The XML parser is part of the Oracle9i platform on every operating system where Oracle9i is ported.
Oracle XML Parser is also implemented in PL/SQL. Existing PL/SQL applications can be extended to take advantage of Oracle XML technology.
Oracle9i provides an integrated suite of tools and components for building e-business applications:
This suite of tools ensure that exchanging data and document objects is simplified for application development and that multiple serializations is eliminated.
Oracle JDeveloper is an integrated environment for building, deploying, and debugging applications leveraging Java and XML on Oracle9i. It facilitates working in Java 1.1 or 1.2 with CORBA, EJB, and Java Stored Procedures. With it you can do the following:
Examples of applications built using Oracle JDeveloper include:
See Chapter 11, "Using JDeveloper to Build Oracle XML Applications" for more information on JDeveloper and XML applications.
Business Components for Java (BC4J) is an Oracle9i application framework for encapsulating business logic into reusable libraries of Java components and reusing the business logic through flexible, SQL-based views of information.
Access to Oracle9i Internet File System (9iFS) facilitates organizing and accessing documents and data using a file- and folder-based model through standard Windows and Internet protocols such as SMB, HTTP, FTP, SMTP, and IMAP4.
9iFs facilitates building and administering Web-based applications. It is an application interface for Java and can load a document, such as a Powerpoint file, into Oracle9i and display the document from a Web server, such as Oracle9i Application Server or Apache Web Server.
9iFS is a simple way for developers to work with XML, where iFS serves as the repository for XML. 9iFS automatically parses XML and stores content in tables and columns. 9iFS renders the content when a file is requested delivering select information, for example, on the Web.
For more information see http://otn.oracle.com/products/ifs/
Oracle Portal can, for example, input XML-based Rich Site Summary (RSS) format documents, and merge the information with an XSL stylesheet. The result can be rendered in a browser. This design efficiently separates the rendition of information from the information itself and allows for easy customization of the look and feel without risk to data integrity.
Oracle Portal is software for building and deploying enterprise portals, the Web sites that power an e-business. The browser interface delivers an organized, personalized view of business information, Web content, and applications needed by each user. It includes site-building and self-service Web publishing functionality of WebDB 2.2 and adds new enterprise portal features such as single sign-on, personalization, and content classification. Oracle Portal uses Oracle9i and is deployed on and packaged with Oracle9i Application Server.
Portlets are reusable interface components that provide access to Web-based resources. Any Web page, application, business intelligence report, syndicated content feed, hosted software service or other resource can be accessed through a portlet, allowing it to be personalized and managed as a service of Oracle Portal. Companies can create their own portlets and select portlets from third-party portlet providers. Oracle provides a Portal Developer's Kit (PDK) for developers to easily create portlets using PL/SQL, Java, HTML, or XML.
See Also:
Chapter 15, "Using the PDK for Visualizing XML Data in Oracle Portal" for an introduction to Oracle Portal's PDF and URL Services. |
The Oracle Exchange platform is based on Oracle9i. It offers all necessary business transactions to support an entire industry's or a company's supply chain. Oracle Exchange is based on Oracle's e-Business Suite, which supports a supply chain from the initial contact with the prospect, to manufacturing planning and execution, to post-sales ongoing service and support.
Oracle Exchange uses XML as its data exchange format and message payload, and Advanced Queueing.
XML Gateway is a set of services that allow you to easily integrate with the Oracle e-Business Suite, to create and consume XML messages triggered by business events. It also integrates with Oracle Advanced Queuing to enqueue/dequeue messages which are then transmitted to/from business partners through any message transport service, including Oracle Message Broker.
Metadata API provides a centralized, simple, and flexible means for performing the following tasks:
Metadata API is available on Oracle9i whenever the instance is operational. It is not available on Oracle Lite.
Besides these tools, the following initiatives are underway.
Support for XML Metadata Interchange (XMI) specification proposed by Oracle, IBM, and Unisys. This enables application development tools and data warehousing tools from Oracle and others to exchange common metadata, ensuring that you can choose any tool without having to modify your application and warehouse design.
Oracle Advanced Queueing (AQ) now allows reliable propagation of asynchronous messages, including messages with XML documents, document sections, or even fragments as their payload, over secure HTTP. This enables dynamic trading and eliminates delays and startup costs to establish inter-company or inter-agency links.
This manual contains examples that illustrate the use of Oracle XML components. The examples do not conform to one schema. Where examples are available for download or supplied with the $ORACLE_HOME/rdbms/demo
or $ORACLE_HOME/xdk/.../sample
, this is indicated.
Oracle8i and higher includes native support for internet standards, including Java and XML. You can run Oracle XML components and applications built with them inside the database itself using Oracle JServer, a built-in Java Virtual Machine.
Use Oracle Lite to store and retrieve XML data, for devices and applications that require a smaller database footprint.
Oracle XML components can be downloaded for free from http://otn.oracle.com/tech/xml
The following are requirements for XDK for Java and XDK for PL/SQL:
Requirements are also discussed in the XDK chapters, chapters 19 through 29, and Appendixes C though G.
Table 1-1 lists the XDK component versions included with Oracle9i Database and Oracle9i Application Server (Oracle9iAS):
Besides your regular channels of support through your customer representative or consultant, technical support for Oracle XML-enabled techologies is available free through the Discussions option on Oracle Technology Network (OTN):
You do not need to be a registered user of OTN to post or reply to XML-related questions on the OTN technical discussion forum. To use the OTN technical forum follow these steps:
You will find the latest information about the Oracle XML components and can download them from OTN:
At the top, under Download Oracle Products, Drivers, and Utilities, in the Select a Utility or Driver pull down menu, scroll down and select any of the XML utilities listed. For the latest XML Parser for Java and C++, select v2.
|
Copyright © 1996-2001, Oracle Corporation. All Rights Reserved. |
|