XML.Export

Previous Next

Generates XML output based on the result of a SELECT statement. The structure of this XML output is described in "XML Representation of Application Data".

A corrective constraint may use the XML.Export method to fill or update a database column with the XML output.

Syntax

INVOKE XML.Export WITH

SELECT      value    parameter-name

,           expression

FROM        table

ORDER BY   order-by-list

 

The required SELECT output-list must contain at least 1 item. It is made up of 0 or more value  parameter-name pairs and 0 or more (SQL) expressions. The possible values for value  parameter-name are listed in the table below. The possible values for expression are:

column

OLD( column 

*

OLD(*)

 

Other SQL functions than OLD() are NOT supported.

It is customary, but not mandatory, to list value parameter-name pairs before expressions. The order of the expressions in the SELECT output-list determines the order of the attributes in the XML output. The optional ORDER BY clause determines the document order of the records in the XML output.

The required FROM clause must contain the name of exactly 1 table or logical view.

Example

INVOKE    XML.Export WITH 

SELECT    'yes'  UseIOFormats

,         * 

FROM      tour

Parameters

This table lists all value parameter-name pairs supported in the SELECT output-lists passed to XML.Export. The use of each parameter-name is optional. If you do not specify a given parameter-name and it has a default value corresponding to it, this is the value applied.

Both values and parameter-names are case-insensitive.

value

parameter-name

Description

{ yes | no }

AppendToFile

Value is a string and must be quoted, as in the example earlier in this help topic.

 

This parameter is used with the "WriteOutputTo" parameter. If you specify 'yes' for this parameter, the file is appended to. Otherwise, it is overwritten.

{ yes | no }

ConvertWhiteSpaces

Value is a string and must be quoted, as in the example earlier in this help topic.

 

If you specify 'yes' for this parameter, then tab characters, spaces, newline characters and carriage returns/line feeds are converted to 	   
 and &#xD respectively. When the resulting XML document is imported using XML Import, the converted values are switched back into tab characters, spaces, newline characters and CR/LFs.

header-line-name

DTDName

This parameter is used to specify 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.

{ yes | no }

EmptyDocOnZeroRows

Value is a string and must be quoted, as in the example earlier in this help topic.

 

If set to 'no' (the default), if the SELECT statement of the XML export does not return any rows, USoft returns an empty string. This makes it difficult to apply any transformation on the result of the XML export.

 

If set to ‘yes’, then the output is always an XML document. If no rows are returned, this XML document contains only a root tag with the same name as the info window name.

{ Insert | Delete | Update }

ExecutionType

Value is a string and must be quoted, as in the example earlier in this help topic.

 

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.

{ yes | no }

UseIOFormats

Value is a string and must be quoted, as in the example earlier in this help topic.

 

If you specify 'yes' for this parameter, column values in the resulting XML output get the IO format of the corresponding domain. Otherwise they are written as they are retrieved from the database.

USFile-alias

output-file-name

WriteOutputTo

This parameter is used to specify that 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.

{ yes | no }

XmlDeclaration

Value is a string and must be quoted, as in the example earlier in this help topic.

 

If you specify 'yes' for this parameter, the default Rules Engine encoding is returned in XML processing instructions. Otherwise no encoding processing instruction is added to the returned XML document.

See Also

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