XML.SQL2XML

Previous Next

Converts SQL syntax to XML format. The SQL statement must be syntactically and semantically correct. If the SQL statement cannot be parsed, for example if tables or columns used in the SQL statement are not defined, an error is given.

Syntax

INVOKE    XML.SQL2XML WITH

SELECT       sql-statement     SQLStatement

           schema-path       SchemaPath

           xml-declaration   XmlDeclaration

FROM        ...

 

xml-declaration  := { No | Yes }

 

All parameter names and values are case-insensitive.

The required sql-statement value is the SQL statement to be converted to XML. Each single quote (') in this SQL statement must be escaped by two consecutive single quotes: '':

SELECT    'insert into tour( destination, tour_type) values (''AUSTRALIA'',''SUMMER_TRIP'')'   SQLStatement

 

The optional schema-path value provides a path to an XML schema definition (XSD) file. A schema file with extension .xsd is delivered with the USoft product:

<USoft installation folder>/xsl/ExtendedConditions/SQL2XML.xsd

 

To validate the generated XML against this schema, schema-path must be specified. If schema-path is not specified, no reference to a schema is generated into the XML document.

The optional xml-declaration value determines that the default Rules Engine encoding is to be returned in XML processing instructions or not if this value is 'Yes'.

If it is 'No', no encoding processing instruction is added to the returned XML document.

 

Example

INVOKE XML.SQL2XML WITH

SELECT

    'SELECT * FROM TOUR' SQLStatement,

    'C:\Program Files\USD70\xsl\ExtendedConditions\SQL2XML.xsd'  SchemaPath

 

This results in the following XML output:

<?xml version="1.0" encoding="Windows-1252"?>

<SqlNode version="1.0"

        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

        xsi:noNamespaceSchemaLocation=

        "C:\Program Files\USD70\xsl\ExtendedConditions\SQL2XML.xsd">

<Select>

    <SelectList>

     <SelectListElement position="1">

     <Column name="*" table_name="TOUR" table_info_window_name="Tours" position="1"/>

     </SelectListElement>

    </SelectList>

    <TableList>

     <TableListElement name="TOUR" info_window_name="Tours" position="1"/>

    </TableList>

</Select>

</SqlNode>

 

A complete description of all SQL syntax elements and how they are converted to XML elements and attributes can be found in:

C:\<USoft installation folder>\Help\SQL2XML.doc