Oracle® XML Developer's Kit Programmer's Guide
10g Release 2 (10.1.2) Part No. B14033-01 |
|
Previous |
Next |
This chapter contains these topics:
Oracle XML Developer's Kit (XDK) is a set of components, tools, and utilities that eases the task of building and deploying XML-enabled applications.
Release notes for XDK are found in /xdk/doc/readme.html
.
Table 1-1 summarizes the standards supported by the XDK Components:
Table 1-1 Standards Supported by XDK Components
Standard | Java | C | C++ |
---|---|---|---|
XML 1.0 (Second Edition) | Full | Full | Full |
XML Namespaces 1.0 | Full | Full | Full |
XML Base | Only in XSLT | Not supported | Not supported |
XML Schema 1.0 | Full | Full | Full |
DOM 1.0 | Full | Full | Full |
DOM 2.0 Core | Full | Full | Full |
DOM 2.0 Events | Full | Full | Full |
DOM 2.0 Transversal and Range | Full | Full | Full |
DOM 3.0 Load and Save (working draft) | Partial | Not supported | Not supported |
DOM 3.0 Validation (working draft) | Full | Not supported | Not supported |
SAX 1.0 | Full | Full | Full |
SAX 2.0 Core | Full | Full | Full |
SAX 2.0 Extension | Full | Full | Full |
XSLT 1.0 | Full | Full | Full |
XSLT 2.0 with backward compatibility | Partial support | Not supported | Not supported |
XPath 1.0 | Full | Full | Full |
XPath 2.0 with backward compatibility (working draft) | Partial support | Not supported | Not supported |
XML Pipeline 1.0 (Notes) | Partial | Not supported | Not supported |
JAXP 1.1 (JSR Standard) | Full | Not applicable | Not applicable |
JAXP 1.2 (JSR Standard) | Full | Not applicable | Not applicable |
JAXB 1.0 (JSR Standard) | Partial support | Not applicable | Not applicable |
Class Generator (Oracle proprietary product) | Not applicable | Not applicable | Full |
Oracle has representatives participating actively in the following W3C Working Groups:
XML Core
XML Schema
XML Query
XSL/XPath
XLink/XPointer
XML Namespaces
DOM
SAX
Oracle has representatives participating actively on the following JSR standards:
JAXB
JAXP
The XDK is fully supported and comes with a commercial redistribution license. To provide a broad variety of deployment options, the XDK components are available for Java, C, and C++. Table 1-2 lists and describes the Oracle XDK components.
Table 1-2 Overview of Oracle XDK Components
XDK Component | Description | Supported Languages | See Also |
---|---|---|---|
XML Parsers | Create and parse XML using industry standard DOM and SAX interfaces. | Java, C, and C++ | Chapter 3, "XML Parser for Java"
Chapter 14, "XML Parser for C" Chapter 19, "XML Parser for C++" |
XSLT Processors | Transforms or renders XML into other text-based formats such as HTML. | Java, C, and C++ | Chapter 4, "XSLT Processor for Java"
Chapter 15, "XSLT Processors for C" Chapter 20, "XSLT Processor for C++" |
XVM
|
High performance XSLT transformation engine that supports compiled stylesheets. | C and C++ | "XVM Processor"
|
XML Schema Processors | Validates schemas. It allows use of XML simple and complex datatypes. | Java, C, and C++ | Chapter 5, "XML Schema Processor for Java"
Chapter 16, "XML Schema Processor for C" Chapter 21, "XML Schema Processor for C++" |
JAXP
|
Gives you the ability to use the SAX, DOM, and XSLT processors, or alternate processors, from your Java application. | Java | "Using JAXP"
|
JAXB Class Generator | Creates Java classes based on an XML Schema. Replaces XML Class Generator for Java. | Java | Chapter 6, "Using JAXB Class Generator"
|
XML Class Generator | Automatically generates C++ classes from DTDs and XML Schemas to send XML data from Web forms or applications. | C++ | Chapter 23, "XML Class Generator for C++"
|
XML SQL Utility (XSU) (XSU) | Generates XML documents, DTDs and Schemas from SQL queries. Maps any SQL query result to XML and vice versa. | Java and PL/SQL | Chapter 7, "XML SQL Utility (XSU)"
|
XSQL Servlet | Combines XML, SQL, and XSLT in the server to deliver dynamic Web content. | Java | Chapter 8, "XSQL Pages Publishing Framework"
|
XML Pipeline Definition Language | Applies a set of XML processes specified in a declarative XML XPipe file.
|
Java | Chapter 9, "Pipeline Definition Language for Java"
|
XML JavaBeans: | A set of bean encapsulations of XDK components for ease of use of Integrated Development Environment (IDE), Java Server Pages (JSP), and applets. | Java | Chapter 10, "XDK JavaBeans"
|
Oracle SOAP Server | The Simple Object Access Protocol (SOAP) is a lightweight protocol for sending and receiving requests and responses across the Internet. | Java | Chapter 11, "Using XDK and SOAP"
|
TransX Utility
|
Loads translated seed data and messages into the database using XML. | Java | Chapter 12, "TransX Utility"
|
XML Compressor | Binary compression and decompression of XML documents. | Java | "About XML Compressor"
|
To work with XML technology, you need to be familiar with the tools to parse XML, validate XML against a DTD or XML schema, transform XML by applying a stylesheet, and generate XML documents based on data selected from a database by means of SQL statements. See Table 1-2, "Overview of Oracle XDK Components", column "See Also," for cross-references to the components. XML Compressor supports only Java. Figure 1-1 shows a simple overview of XDK.
The XML Parsers read the XML document, and use either DOM APIs for navigating a tree-like representation of the XML document, or a Simple API for XML (SAX) event-based interface that requires less memory. The XML Parser for Java supports JAXP. JAXP enables processing of XML documents using DOM, SAX, and XSLT independently of the XML processor implementation. XML Compressor is also integrated into the parser. This reduces the size of XML message payloads.
Figure 1-2 illustrates the Oracle XML Parsers functionality.
The Oracle XSLT engine fully supports the W3C XSL Transformations recommendation. It has the following features:
Enables standards-based transformation of XML information inside and outside the database on any operating system.
The Oracle XML Parsers include an integrated XSL Transformation (XSLT) Processor for transforming XML data using XSL stylesheets. Using the XSLT processor, you can transform XML documents from XML to XML, to HTML, or to virtually any other text-based format.
See Also:
|
JAXB Class Generator creates a set of Java classes for creation of XML documents corresponding to an input XML Schema. JAXB does not support DTDs. These classes are then used in a Java application. The C++ Class Generator creates a set of C++ classes for creation of XML documents corresponding to an input DTD or XML Schema. These classes are then used in a C++ application.
JAXB Class Generator supports data binding. An XML instance document can be input to load the instance data at runtime directly into the generated classes from a DTD. This improves memory usage and performance compared to DOM APIs.
XML Schema was created by the W3C to describe the content and structure of XML documents in XML, thus improving on DTDs. XML Schema Processor introduces the concept of datatypes to XML. This allows data to be exchanged between databases using XML syntax.
The Oracle XDK JavaBeans are a set of visual and non-visual beans that are useful in creating a variety of XML-enabled Java applications or applets. XDK JavaBeans comprises the following beans:
The XSLTransformer
JavaBean is a non-visual bean. It accepts an XML file, applies the transformation specified by an input XSL stylesheet and creates the resulting output file.
XML SQL Utility is comprised of core Java class libraries that:
Automatically and dynamically render the results of arbitrary SQL queries into canonical XML.
Support queries over richly-structured user-defined object types and object views, including XMLType
.
XML SQL Utility Java classes can be used for the following tasks:
Load data from an XML document into an existing database schema or view.
Support automatic XML insert of canonically-structured XML into any existing table, view, object table, or object view. By combining with XSLT transformations, virtually any XML document can be automatically inserted into the database.
Note: XSU for PL/SQL is also available. Oracle XML SQL Utility (XSU) for Java has these features. |
Figure 1-4 shows the Oracle XML SQL Utility functionality for loading data from XML documents into a database schema or view:
The XSQL Pages Publishing Framework (XSQL Servlet) is a server component that produces dynamic XML documents from one or more SQL queries of data objects. It does this by processing an XSQL file, which is simply an XML file with a specific structure and grammar. The XSQL Servlet uses Oracle's XML Parser to process this file and pass any XSLT processing statements to its internal XSLT Processor while passing the parameters and SQL statements between the tags to the XML SQL Utility. Results from those queries are then received as either XML-formatted text or a JDBC ResultSet
object. If necessary, the query results can be further transformed into any desired format using the built-in XSLT processor.
The Oracle TransX Utility is a data transfer utility that enables you to populate your database with multilingual data. It uses XML to specify the data, so that you can easily transfer from XML to the database. It uses a simple data format that is intuitive for both developers and translators and it uses a validation capability that is less error-prone than previous techniques.
Oracle SOAP Services is published, located and executed through the Web. It is transport protocol-independent and operating system-independent. SOAP Services provide the standard XML message format for all applications. With SOAP Services, you can build messaging, RPC, and Web service applications with XML standards.
Each of the language components will be employed to generate XML documents.
XSU can render the results of arbitrary SQL queries into canonical XML.
Figure 1-5 shows how XML SQL Utility processes SQL queries and returns the results as an XML document.
Figure 1-5 XML SQL Utility Processes SQL Queries and Returns the Result as an XML Document
The structure of the resulting XML document has these attributes:
Columns are mapped to top level elements
Scalar values are mapped to elements with text-only content
Object types are mapped to elements with attributes appearing as sub-elements
Collections are mapped to lists of elements
The XML SQL Utility (XSU) supports SAX event stream. XSU also generates either of the following:
A string representation of the XML document. Use this representation if you are returning the XML document to a requester.
An in-memory XML DOM tree of elements. Use this representation if you are operating on the XML programmatically, for example, transforming it using the XSLT Processor using DOM methods to search or modify the XML in some way.
A series of SAX events which can be used when simply retrieving XML especially large documents or result sets.
You can also use the XML SQL Utility (XSU) to generate a DTD or an XML Schema based on the schema of the underlying table or view being queried. You can use the generated DTD as input to the JAXB Class Generator for Java or the C++ Class Generator. This generates a set of classes based on the DTD elements. You can then write code that uses these classes to generate the infrastructure behind a Web-based form.
Based on this infrastructure, the Web form can capture user data and create an XML document compatible with the database schema. This data can then be written directly to the corresponding database table or object view without further processing.
Note: To write an XML document to a database table, where the XML data does not match the underlying table structure, transform the XML document before writing it to the database. For techniques on doing this, see Chapter 7, "XML SQL Utility (XSU)". |
Figure 1-6 shows the Oracle XDK Java components and how they can be used to generate XML documents. Cross-references to XDK Java components are listed in Table 1-2, "Overview of Oracle XDK Components".
In the Java environment, when a SQL query is sent, these are the possible ways of processing the query using the Oracle XDK components:
By the XSQL Servlet (this includes using XSU and XML Parser for Java)
Directly by the XSU (this includes XML Parser for Java)
Directly by JDBC which then accesses XML Parser
Regardless of which way the stored XML data is generated from the database, the resulting XML document output from the XML Parser for Java is further processed; it is formatted and customized by applying stylesheets and processed by the XSLT.
Figure 1-6 Generating XML Documents Using XDK Java Components
Figure 1-7 shows the Oracle XDK C language components used to generate XML documents. Available XDK C components are listed in Table 1-2, "Overview of Oracle XDK Components"
SQL queries can be sent to the database by Oracle Call Interface (OCI) or by the Pro*C/C++ Precompiler.
The resulting XML data can be processed in the following ways:
With the XML Parser
From the CLOB as an XML document
This XML data is optionally transformed by the XSLT processor, viewed directly by an XML-enabled browser, or sent for further processing to an application.
Figure 1-7 Generating XML Documents Using XDK C Components
Figure 1-8 shows the Oracle XDK C++ components used to generate XML documents. Available XDK C++ components are listed in Table 1-2, "Overview of Oracle XDK Components"
In the C++ environment, when a user or client or application sends a SQL query, there are two possible ways of processing the query using the XDK C++ components:
Directly by JDBC which then accesses the XML Parser
Through the Oracle C++ Call Interface (OCCI) or the Pro*C/C++ Precompiler
Figure 1-8 Generating XML Documents Using XDK C++ Components
Figure 1-9 shows an overview of how the Oracle XML components enable development of E-business solutions.
A user who is a consumer or works for a business, sends SQL queries to an Oracle database either through a Java, C, or C++ application. These applications as well as development tools such as XSQL Pages Publishing Framework, JDeveloper, and so on, transform data from the database into XML documents. These XML documents are input to XML-based business solutions for data exchange with other users, content and data management, and other uses listed in the illustration.
Figure 1-9 Oracle XML Components and E-Business Solutions
The following topics are presented in this section:
The following browsers support the display of XML:
Opera. XML, in version 4.0 and higher
Citec Doczilla. XML and SGML browser
Indelv. Displays XML documents only using XSL
Mozilla Gecko. Supports XML, CSS1, and DOM1
HP ChaiFarer. Embedded environment that supports XML and CSS1
ICESoft embedded browser. Supports XML, DOM1, CSS1, and MathML
Microsoft IE5. Has a full XML parser, IE5.x or higher
Netscape 5.x or higher
XML Gateway is a set of services that enables easy integration with the Oracle E-Business Suite to create and consume XML messages triggered by business events. It integrates with Oracle Streams Advanced Queuing to enqueue and dequeue a message which is then transmitted to or from the business partner through any message transport agent.
See Also:
|
Oracle Data Provider for .NET (ODP.NET
) is an implementation of a data provider for the Oracle Database.
ODP.NET
uses Oracle native APIs to offer fast and reliable access to Oracle data and features from any .NET application. ODP.NET
also uses and inherits classes and interfaces available in the Microsoft .NET Framework Class Library.
ODP.NET
enables the extraction of data from relational and object-relational tables and views as XML documents using the Oracle XDK. The use of XML documents for insert, update, and delete operations to the database server is also allowed.
ODP.NET
supports XML natively in the database, through Oracle XML Database (Oracle XML DB).
ODP.NET
supports XML with the following features:
Store XML data natively in the database server as the Oracle native type XMLType
.
Access relational and object-relational data as XML data from an Oracle Database instance into Microsoft .NET
environment and process the XML using Microsoft .NET framework.
Save changes to the database server using XML data.
For the .NET application developer, features include the following:
Enhancements to the OracleCommand
, OracleConnection
, and OracleDataReader
classes.
XML-specific classes:
OracleXmlType
OracleXmlStream
OracleXmlQueryProperties
OracleXmlSaveProperties
See Also: Oracle Data Provider for .NET Developer's Guide |
Oracle JDeveloper is a J2EE development environment with end-to-end support for developing, debugging, and deploying e-business applications. JDeveloper empowers users with highly productive tools, such as the industry's fastest Java debugger, a new profiler, and the innovative CodeCoach tool for code performance analysis and improvement.
To maximize productivity, JDeveloper provides a comprehensive set of integrated tools that support the complete development life cycle, from source code control, modeling, and coding through debugging, testing, profiling, and deployment. JDeveloper simplifies J2EE development by providing wizards, editors, visual design tools, and deployment tools to create high-quality standard J2EE components, including applets, JavaBeans, Java Server Pages (JSP), servlets, and Enterprise JavaBeans (EJB). JDeveloper also provides a public API to extend and customize the development environment and seamlessly integrate it with external products.
The Oracle XDK is integrated into JDeveloper, offering many ways to create, handle, and transform XML. For example, with the XSQL Servlet, developers can query and manipulate database information, generate XML documents, transform the documents using XSLT stylesheets, and make them available on the Web.
JDeveloper has an integrated XML schema-driven code editor for working on XML Schema-based documents such as XML schemas and XSLT stylesheets, with tag insight to help you easily enter the correct elements and attributes as defined by the schema.
An XML Schema Definition defines the structure of an XML document and is used in the editor to validate the XML and help developers when typing. This feature is called Code Insight and provides a list of valid alternatives for XML elements or attributes in the document. Just by specifying the schema for a certain language, the editor can assist you in creating a document in that markup language.
Oracle JDeveloper simplifies the task of working with Java application code and XML data and documents at the same time. It features drag-and-drop XML development modules. These include the following:
Color-coded syntax highlighting for XML
Built-in syntax checking for XML and Extensible Style Sheet Language (XSL)
XSQL Pages and Servlet support, where developers can edit and debug Oracle XSQL Pages, Java programs that can query the database and return formatted XML or insert XML into the database without writing code. The integrated servlet engine enables you to view XML output generated by Java code in the same environment as your program source, making it easy to do rapid, iterative development and testing.
Includes Oracle's XML Parser for Java
Includes XSLT Processor
Related XDK for JavaBeans components
XSQL Page Wizard
XSQL Action Handlers
Schema-driven XML editor
See Also:
|
UIX (User Interface XML) is a set of technologies that constitute a framework for building Web applications. The main focus of UIX is the user presentation layer of an application, with additional functionality for managing events and for managing the state of the application flow. UIX is designed to create applications with page-based navigation, such as an online human resources application, rather than full-featured applications requiring advanced interaction, such as an integrated development environment (IDE).
See Also: For sample JDeveloper Demonstration code for UIX:
|
Here is another XML Frequently Asked Question site:
Here are some books and Web sites about XML. URLs are often changed, so some URLs in this list are not active links:
The publisher WROX has a number of helpful books. One of these, XML Design and Implementation by Paul Spencer, covers XML, XSL and development.
Building Oracle XML Applications by Steve Muench (published by O'Reilly) See http://www.oreilly.com/catalog/orxmlapp/
The XML Bible. See http://www.ibiblio.org/xml/books/biblegold/
Oracle9i XML Handbook by the Oracle XML Product Development Team at http://www.osborne.com/oracle/
XML, Java, and the Future of the Web by Jon Bosak, Sun Microsystems http://metalab.unc.edu/pub/sun-info/standards/xml/why/xml apps.htm
XML for the Absolute Beginner by Mark Johnson, JavaWorld http://www.javaworld.com/jw-04-1999/jw-04-xml_p.html
XML And Databases by Ronald Bourret, Technical University of Darmstadt http://www.informatik.tu-darmstadt.de/DVS1/staff/bourret/ XML/
XMLAndDatabases.htm
and the XML Specifications by the World Wide Web Consortium (W3C) http://www.w3.org/XML/
XML.com
, a broad collection of XML resources and commentary http://www.xml.com/
Annotated XML Specification by Tim Bray, XML.com
http://www.xml.com/axml/testaxml.htm
The XML FAQ by the W3C XML Special Interest Group (the industry clearing house for XML DTDs that allow companies to exchange XML data) http://www.ucc.ie/xml/ XML.org
http://xml.org/
xDev (the DataChannel XML Developer pages) http://xdev.datachannel.com/
This section includes general information about Oracle XML-enabled technology, contained in the topics:
Here are topics about using the XDK:
You can use the Apache Web server which must now interact with Oracle through JDBC or other means. You can use the XSQL servlet. This is a servlet that can run on any servlet-enabled Web server. This runs on Apache and connects to the Oracle database through a Java Database Connectivity (JDBC) driver.
Whether you still need an XML parser if all XML was created by your programs depends on what you intend to do with the generated XML. If your task is just to generate XML and send it out then you might not need it. But if you wanted to generate an XML DOM tree then you need the Parser. You also need it if you have incoming XML documents and you want to parse and store them. See the XML SQL utility for some help on this issue.
If you have the following scenario:
... <something> <price>10.00</price> </something> ... ... ... <somethingelse> <price>55.00</price> </somethingelse>
Is there a way to uniquely identify the two <price>
elements?
Answer: No. The field description in the control file can be nested, which is part of the support for object relational columns. The data record to which this maps is, of course, flat but using all the data field description features of the SQL*Loader one can get a lot done. For example:
sample.xml
<resultset> <emp> <first>...</first> <last>...</last> <middle>....</middle> </emp> <friend> <first>...</first> <last>...</last> <middle>....</middle> </friend> </resultset>
sample.ctl
-- field definition part of the SQL Loader control file
field list .... ( emp COLUMN OBJECT .... ( first char(30) enclosed by "<first>" and "</first>", last char(30) enclosed by "<last>" and "</last>", middle char(30) enclosed by "<middle>" and "</middle>" ) friend COLUMN OBJECT .... ( first char(30) enclosed by "<first>" and "</first>", last char(30) enclosed by "<last>" and "</last>", middle char(30) enclosed by "<middle>" and "</middle>" )
Keep in mind that the COLUMN OBJECT
field names have to match the object column in the database. You will have to use a custom record terminator, otherwise it defaults to newline
(that is, the newline
separates data for a complete database record).
If your XML is more complex and you are trying to extract only select fields, you can use FILLER
fields to reposition the scanning cursor, which scans from where it has left off toward the end of the record (or for the first field, from the beginning of the record).
The SQL*Loader has a very powerful text parser. You can use it for loading XML when the document is very big.
These sections concern previous Oracle releases.
You can go a long way with Oracle database version 7. The only problem is that you cannot run any of the Java programs inside the server; that is, you cannot load all the XML tools into the server. But you can connect to the database by downloading the Oracle JDBC utility for Oracle database version 7 and run all the programs as client-side utilities.
Question: My company has Oracle release 7.3.4 and my group is thinking of using XML for some data transfers between us and our vendors. It looks as if we need to move to Oracle8i or higher in order to do so. Is there any way of leveraging Oracle release 7 to do XML?
Answer: As long as you have the appropriate JDBC 1.1 drivers for Oracle release 7.3.4 you can use the XML SQL Utility to extract data in XML.
For JDBC drivers, refer to the following Web site for information about Oracle database version 7 JDBC OCI and JDBC Thin Drivers:
If I am using an Oracle version earlier than Oracle8i, can I supply XML- based applications using Oracle XML tools? If yes, then what are the licensing terms?
The Oracle XDKs for Java, C, and C++ can work outside the database, including the XML SQL Utility and XSQL Pages framework. Licensing is the same, including free runtime. See Oracle Technology Network (OTN) for the latest licenses.
Here are discussions about XML standards that Oracle supports.
What B2B XML standards (such as ebXML, cxml, and BizTalk) does Oracle support? What tools does Oracle offer to create B2B exchanges?
Oracle participates in several B2B standards organizations:
OBI (Open Buying on the Internet)
ebXML (Electronic Business XML)
RosettaNet (E-Commerce for Supply Chain in IT Industry)
OFX (Open Financial Exchange for Electronic Bill Presentment and Payment)
For B2B exchanges, Oracle provides several alternatives depending on customer needs, such as the following:
Oracle Exchange delivers an out-of-the-box solution for implementing electronic marketplaces
OracleAS Process Connect has B2B and capability.
Oracle Gateways for exchanges at data level
Oracle XML Gateway to transfer XML-based messages from our e-business suite.
The Oracle Internet support provides an integrated and solid platform for B2B exchanges.
Oracle Corporation's XML strategy is to use XML in ways that exploit all of the benefits of the current Oracle technology stack. Today you can combine Oracle XML components with the Oracle database and Streams to achieve conflict resolution, transaction verification, and so on. Oracle is working to make future releases more seamless for these functions, as well as for functions such as distributed two phase commit transactions.
The XMLType
datatype is used for storing XML in a column in a table or view.
See Also: Oracle XML DB Developer's Guide |
XML data is stored either in object-relational tables or views, or as CLOBs. XML transactions are transactions with one of these datatypes and are handled using the standard Oracle mechanisms, including rollback segments, locking, and logging.
From Oracle9i onward, Oracle supports sending XML payloads using Streams. This involves making it possible to query XML from SQL.
Oracle is active in all XML standards initiatives, including W3C XML Working Groups, Java Extensions for XML, Open Applications Group, and XML.org
for developing and registering specific XML schemas.
Oracle is participating in the W3C Working Group for XML Query. Oracle is considering plans to implement a language that enables querying XML data, such as in the XSQL proposal. While XSLT provides static XML transformation features, a query language will add data query flexibility similar to what SQL does for relational data.
Oracle has representatives participating actively in the following W3C Working Groups related to XML and XSL: XML Schema, XML Query, XSL, XLink/XPointer, XML Infoset, DOM, and XML Core.
Here are maximum XML file sizes.
There are no XML limitations to an XML file size except the limit of the operating system.