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

Using XML-SQL Utility (XSU), 8 of 26

## Generating XML using XSU's Front-End

To use the generation capabilities, call XSU with the getXML parameter. For example, to generate an XML document by querying the emp table under scott schema,

    java OracleXML getXML -user "scott/tiger" "select * from emp"

This performs the following tasks:

- Connects to the current default database

- Executes the query "select * from emp"

- Converts the result to XML

- Displays the result

getXML supports a wide range of options which are explained in the following section.

#### OracleXML - getXML Options

- -user "<username>/<password>"

  Used to specify the user name and password to connect to the database. If this is not specified, the user defaults to "scott/tiger". Note that he connect string is also being specified, the user name and password can be specified as part of the connect string.

- -conn "<JDBC_connect_string>"

  Used to specify the JDBC database connect string. By default the connect string is: "jdbc:oracle:oci8:@"):

- -withDTD

  Instructs the XSU to generate the DTD along with the XML document.

- -rowsetTag "<tag_name>"

  Used to specify rowset tag (i.e. the tag that encloses all the XML elements corresponding to the records returned by the query) The default rowset tag is ROWSET. Specifying an empty string for the rowset tells the xsu to completely omit the rowset element.

- -rowTag "<tag_name>"

  Used to specify the row tag (the tag used to enclose the data coresponding to a database row). The default row tag is ROW. Specifying an empty string for the row tag tells the xsu to completely omit the row tag.

- -rowIdAttr "<row_id-attribute-name>"

  Used to name the attribute of the ROW element keeping track of the cardinality of the rows. By default this attribute is called "num". Specifying an empty string (i.e. "") as the row id attribute will tell the XSU to omit the attribute.

- -rowIdColumn "<row Id column name>"

  Used to specify that the value of one of the scalar columns from the query should be used as the value of the row id attribute.

- -collectionIdAttr "<collection id attribute name>"

  Used to name the attribute of a XML list element keeping track of the cardinality of the elements of the list (note: the generated XML lists correspond to either a cursor query, or collection). Specifying an empty string (i.e. "") as the row id attribute will tell the XSU to omit the attribute..

- -useNullAttrId

  Used to tell the XSU to use the attribute "NULL (TRUE/FALSE)" to indicate the nullness of an element.

- -styleSheet "<stylesheet URI>"

  Used to specify the stylesheet in the XML PI (Processing Instruction).

- -stylesheetType "<stylesheet type>"

  Used to specify the stylesheet type in the XML PI (Processing Instruction).

- -errorTag "<error tag name>"

  Used to specify the error tag -- the tag to enclose error messages which are formated into XML.

- -raiseNoRowsException

  Used to tell the XSU to raise an exception if no rows are returned.

- -maxRows "<maximum number of rows>"

  Used to specify the maximum number of rows to be retreived and converted to XML.

- -skipRows "<number of rows to skip>"

  Used to specify the number of rows to be skipped.

- -encoding "<encoding name>"

  Used to specify the characterset encoding of the generated XML.

- -dateFormat "<date format>"

  Used to specify the date format for the date values in the XML document.

- -fileName "<SQL query fileName>" | <sql query>

  Used to specify the file name which contains the query or specify the query itself.

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