The XML Export Method

Previous Next

See Also

The XML export method generates XML output based on a SELECT statement. The structure of the XML output from this method is described in "XML Representation of Application Data".

This XML export method can for example be used in a corrective constraint, to fill or update a database column with the result of the XML export.

SYNTAX

INVOKE XML.Export

WITH

SELECT    [<value> <param>[, <value> <param> ...]]

        <expression>[,expression]

       [,<value> <param>[, <value> <param> ...]]

FROM <table>

[ORDER BY] <order by list>

...

EXAMPLE

INVOKE XML.Export WITH SELECT 'yes' useioformats , * FROM t2_

CONDITIONS

The SELECT statement must comply with the following conditions:

· Value/Parameter pairs and expressions can appear in any order within the SELECT statement.

 

· The FROM clause contains only one table or logical view.

 

· For each parameter value, the parameter name must be specified.

 

· Within one XML export, parameters have constant values.

 

· The order of the columns in the SELECT list determines the order of the attributes in the XML output.

 

· The optional ORDER BY clause determines the order of the records in the XML output.

EXPRESSIONS

The possible values for <expression> are:

<column>, OLD(<column>), *, OLD(*)

PARAMETERS

All parameters are optional, and the parameter names and values (<param> and <value> in the syntax description above) are not case-sensitive. See the examples below for more information.

Parameter

Allowed Values

Description

DTDName

 

Specifies a header line in the XML output with a DOCTYPE declaration containing the DTD Name as reference. See "Document Type Definition (DTD) Specification" for more information.

UseIOFormats

No, Yes

Specifies whether column values in the resulting XML output get the IO format of the corresponding domain or not.

If not they are written as they are retrieved from the database.

ExecutionType

Insert, Delete, Update

Specifies a sub element that will be generated for each resulting row element. This way you can generate XML output with specifications for import actions.

ConvertWhiteSpaces

No, Yes

Specifies whether tab characters, spaces, newline characters and carriage returns/line feeds are converted to &#x9; &#x20; &#xA; and &#xD respectively. When the XML document is imported using XML Import, the converted values are switched back into tab characters, spaces, newline characters and CR/LFs.

XmlDeclaration

No, Yes

Specifies whether the default Rules Engine encoding is to be returned in XML processing instructions. Otherwise no encoding processing instruction is added to the returned XML document.

WriteOutputTo

USFile alias, Output file name

Specifies whether the output is to be written directly to a file. It is possible to use a file which has previously been opened using the USFile.Open method. To do this, the alias used in the USFile.Open method must be specified, preceded by 'USFile.' If no USFile alias is specified, the XML will be written directly to the file specified. If the file exists, it will be overwritten. To prevent this, use the 'Append' parameter. If specified, the method will return the file name.

AppendToFile

No, Yes

This parameter is used with the "WriteOutputTo" parameter. You can use it to specifiy whether the file is to be overwritten, or appended to.

 

 

Related Topics

Example: Simple XML Export

Example: XML Export With DTD Name And IO Formats

Example: XML Export For Update

Example: XML Export in Combination with USFile