Oracle8i Application Developer's Guide - XML Release 3 (8.1.7) Part Number A86030-01 |
Library | Service | Contents | Index

Using JDeveloper to Build Oracle XML Applications, 6 of 11

## XML Features in JDeveloper 3.2

The following lists JDeveloper 3.2 's supported Oracle XML Developer's Kit for Java (XDK for Java) components:

- Oracle XML Parser for Java

- Oracle XSQL Servlet

You can use the XML Parser for Java including the XSLT Processor and the XML- SQL Utility in JDeveloper as all these tools are written in Java. JDeveloper provides these components.

Sample programs which demonstrate how to use these tools can be found in the [JDeveloper]/Samples/xmlsamples directory.

### Oracle XDK and Transviewer Beans Integration

Oracle XDK for Java consists of the following XML tools:

- XML Parser for Java

- XML- SQL Utility for Java

- XML Java Class Generator

- XSQL Servlet

- XML Transviewer Beans

All these utilities are written in Java and hence can easily be dropped into JDeveloper and used 'out of box'. You can also update the XDK for Java components with the latest versions downloaded from Oracle Technology Network (OTN) at http://technet.oracle.com/tech/xml.

Oracle XDK for Java also includes the XML Transviewer Beans. These are a set of Java Beans that permit the easy addition of graphical or visual interfaces to XML applications. Bean encapsulation includes documentation and descriptors that make them accessible directly from JDeveloper. You can drop these beans into the TOOLS palette and use them to build applications such as XML/XSL editors.

See Also: Chapter 20, "Using XML Transviewer Beans" for more information on how to use the Transviewer Beans.

### Oracle XML Parser for Java

Including the Oracle XML Parser for Java in your project allows you to write applications that can search and process XML documents. You can include the Oracle XML Parser in your project with one click as JDeveloper has a built-in library for it.

Code Insight makes understanding and using the code easier and in-place access to JavaDoc on the classes for reference. The XML parser for Java facilitates processing an XML document using either of the following interfaces:

- DOM: a tree of W3C DOM

- SAX: a stream of SAX events

### Oracle XSQL Servlet

The XSQL Servlet is a tool that processes SQL queries and outputs the result set as XML. This processor is implemented as a Java servlet and takes as its input an XML file containing embedded SQL queries. It uses the XML Parser for Java and the XML SQL Utility to perform many of its operations.

The XSQL Servlet offers a productive and easy way to get XML in and out of the database. Using simple scripts you can:

- Generate simple and complex XML documents

- Apply XSL Stylesheets to generate into any text format

- Parse XML documents and store the data in the database

- Create complete dynamic web applications without programming a single line of code

#### JDeveloper XSQL Example 1: emp.xsql

For example, consider the following XML example:

    <?xml version="1.0"?>
    <?xml-stylesheet type="text/xsl" href="emp.xsl"?>
    <FAQ xmlns:xsql="urn:oracle-xsql" connection = "scott">
      <xsql:query doc-element="EMPLOYEES" row-element="EMP">
        select e.ename, e.sal, d.dname as department
        from dept d, emp e
        where d.deptno = e.deptno
      </xsql:query>
    </FAQ>

Generates the following:

    <EMPLOYEES>
      <EMP>
        <ENAME>Scott</ENAME>
        <SAL>1000</SAL>
        <DEPARTMENT>Boston</DEPARTMENT>
      </EMP>
      <EMP>
      ...
    </EMPLOYEES>

With JDeveloper 3.2 you can easily develop and execute XSQL files. The built in Web Server and the user's default Web Browser will be used to display the resulting pages.

#### Using ActionHandlers in XSQL Pages

XSQL ActionHandlers are Java classes which can be invoked from XSQL Page applications very easily. Since these are Java classes they can be debugged from JDevloper just like any other Java application.

If you are building an XSQL Pages application, you can make use of the XSQL Action Handler to extend the set of actions that can be performed to handle more complex jobs. You will need to debug this ActionHandler.

Your XSQL Pages should be in the directory specified in the Project Property "HTML Paths" settings for "HTML Source Directory".

To debug your ActionHandler carry out these steps:

1. Assume you have created an .xsql file which has reference to a custom ActionHandler called MyActionHandler.

2. Debug this ActionHandler because it is not exactly behaving as you expect.

3. Set breakpoints in your Java source file.

4. He right mouse clicks on the .xsql file and now chooses Debug... from the menu.

   See Also: The JDeveloper Guide under the online HELP menu.

### XML Data Generator Web Bean

Oracle JDeveloper has an XML Data Generator Web Bean. It generates XML containing the data from a View Object and renders it to the output stream of a JSP response.

You can author JSP pages that use XML and XSL to render a response to the client.

This XML Web Bean can be used in JSP and Servlet applications. It reads data from a Business Component (View Object) and produces the appropriate XML. The strength of this Web Bean is that it analyzes the Business Component Application and navigates through it's hierarchy to produce the nested XML.

The XML Web Beans also allows the specification of an XSL Stylesheet. In addition to XML, the Web Bean can then generate HTML, WML, transformed XML and any other text format.

### Mobile Application Development with Portal-To-Go and JDeveloper

Portal-To- Go and Oracle JDeveloper together offer an extremely powerful environment for developing mobile applications. Developers can use JDeveloper to generate XML from the database or from a Business Components for Java Application and use Portal-To-Go to deliver content to Web browsers, PDAs, or Cell phones.

| Copyright © 1996-2000, Oracle Corporation. All Rights Reserved. |
Library | Service | Contents | Index