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

Using XSQL Servlet, 8 of 24

## Using the XSQLCommandLine Utility

With the XSQLCommandLine Utility you can post XML to the XSQL page it is processing (typically, for inserting into the database) by specifying the filename or URL of the XML to be posted as the value of the posted-xml command line parameter. For example, posted-xml=filename or posted-xml=http://somesite/someurl are both valid.

Custom action handlers can now refer to the content of the posted XML document any number of times necessary when calling getPageRequest().getPostedDocument(). Previously, the second time calling this returned null.

The XSQLRequest class, the programmatic API to process XSQL Pages from within Java programs, now has a processToXML() method, allowing you to process the XSQL Page and get it's output as a DOM Document object, ready for subsequent processing by your program.

Process any XSQL page at the command line by using the XSQLCommandLine() class, sending the output to standard out or to a file, using the command:

    java oracle.xml.xsql.XSQLCommandLine xsqlURI [outputFile] [param1=value1 ...
    paramN=valueN]

The following files are provided to run the Command Line Utility:

- .\bin\xsql.bat DOS batch file

- ./bin/xsql shell script

These set up the CLASSPATH to contain all JAR files required (same ones listed for the Servlet above), and then calls JRE to run `oracle.xml.xsql.XSQLCommandLine()` class.

#### XSQLCommandLine Utility Examples

Try these XSQLCommandLine Utility example:

- To test the demo file /xsql/airport/airport.xsql type the following:

      xsql xsqlURI [outputFile] [param1=value1 ... paramN=valueN]

- To output results of processing airport.xsql to standard output type the following:

      xsql airport.xsql airport=sfo xml-stylesheet=none

- To output the results to the output.html type the following:

      xsql airport.xsql output.html airport=sfo

- To post an XML Document to an XSQL Page being processed by XSQLCommandLine utility, provide a URL or filename as the value of the posted-xml command-line parameter, such as:

      xsql insertnewsstory.xsql
      posted-xml=http://p.moreover.com/cgi-local/page?index_xml+xml

  This uses the XSQL Page named `insertnewsstory.xsql` to insert the XML contents retrieved by visiting the named URL.

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