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, 9 of 11

## Using XSQL Servlet from JDeveloper

XSQL Servlet offers a productive and easy way to get XML in and out of the database.

See Also: Chapter 3, "Oracle XML Components and General FAQs" and Chapter 19, "Using XSQL Servlet" for information about how to use XSQL Servlet.

When using XSQL Servlet in JDeveloper, you do not need to include the XSQL Runtime in your project as this is already done for any new XSQL Page or XSQL wizard-based application.

Using simple scripts you can do the following from JDeveloper:

- 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

Consider a simple query in an XSQL file, which returns details about all the employees in the emp table. The XSQL code to get this information would be as shown in Example 2:

### JDeveloper XSQL Example 2: Employee Data from Table emp: emp.xsql

    <?xml version="1.0"?>
    <xsql:query xmlns:xsql="urn:oracle-xsql" connection="demo">
        select *
        from emp
        order by empno
    </xsql:query>

Figure 14-7 shows what the raw employee XML data displayed on the browser.

#### Figure 14-7 Employee Data in raw XML Format

If you want to output your data in a tabular form as shown in Figure 14-6, make a small modification to your XSQL code to specify a stylesheet. The changes you would make in this example are shown below highlighted.

### JDeveloper XSQL Example 3: Employee Data with Stylesheet Added

    <?xml version="1.0"?>
    <?xml-stylesheet type="text/xsl" href="emp.xsl"?>
    <xsql:query xmlns:xsql="urn:oracle-xsql" connection="demo">
        select *
        from emp
        order by empno
    </xsql:query>

The result would be like the table shown in Figure 14-6. You can do a lot more with XSQL Servlet of course.

See Also: Chapter 19, "Using XSQL Servlet" and also the XDK for Java, XSQL Servlet Release Notes on OTN at http://technet.oracle.com/tech/xml

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