XML.Import

Previous Next

Processes the row elements of an XML document with their instructions. The behavior of the import method is determined by the processing instructions in the XML document and by the VerifyOriginalValues and UseIOFormats parameters.

The structure of an XML document to be imported is described in " XML Representation of Application Data With Processing Instructions ".

If a DTD is specified in the XML document, the document contents must be in accordance with this DTD. Refer to: "Document Type Definition (DTD) Specification".

Syntax

INVOKE XML.Import WITH

SELECT      value    parameter-name

,           value    parameter-name

,           expression XMLDocument

FROM        table

 

The required SELECT output-list is made up of 0 or more value  parameter-name pairs and 1 required (SQL) expression named by the XMLDocument alias. Possible values for the value  parameter-name pairs are listed in the table below. Expression is usually a filepath pointing to a file on the file system, in which case the FROM clause is typically omitted. If expression refers to a database column, the possible values for expression are:

column

OLD( column )

 

OLD() is not typical here. Other SQL functions than OLD() are NOT supported.

It is customary, but not mandatory, to list value parameter-list pairs before expression.

Example 1

INVOKE  XML.Import WITH 

SELECT  'c:\temp\tours.xml'    XMLDocument 

 

Example 2

INVOKE    XML.Import WITH 

SELECT    'yes'          UseIOFormats

,         description    XMLDocument 

FROM      tour

 

Parameters

This table lists all parameter-names supported in the SELECT output-lists passed to XML.Export. For each parameter-name, possible values are listed. The use of each parameter-name is optional, but if the parameter has a default value, this is the value applied if your statement does not specify otherwise.

Both parameter-names and values are case-insensitive.        

value

parameter-name

Description

{ 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, the imported column values are checked against the IO format of the corresponding domain. Otherwise, they must use the format described in "XML Representation of Date Values".

{No
|ChangedColumns
|AllColumns
|NoCheckOnPk }

VerifyOriginalValues

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

 

For row elements with an Update or Delete instruction, this parameter specifies whether the values in the XML document must be compared with those stored in the database.

See the section below for the meaning of each possible value.

{ 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 as an XML processing instruction. Otherwise, no encoding processing instruction is added to the returned XML document.

VerifyOriginalValues

Setting this parameter allows optimistic locking mechanisms and prevents lost updates if different client applications change the same information concurrently.

The values of the VerifyOriginalValues parameter have the following meaning:

value

Description

No (the default)

No comparison between values in the XML document and the database.

ChangedColumns

Before records are deleted, the values mentioned in the XML document are compared with the column values to be updated in the database.

Before records are updated, the values mentioned in the XML document are compared with the column values to be updated.

AllColumns

Before records are deleted or updated, the values mentioned in the XML document are compared with the corresponding column values in the database.

NoCheckOnPk

In spite of there being a request for update or delete, if the record does not exist in the database, no error will be raised.

See Also

Processing Instructions for XML Import

Reading from File with XML Import

Where to Use the XML Import Method?

How the XML Import Method Processes Row Elements

The Returning XML Document

Basic XML Formats for Import

Importing Parent-Child Data with XML Import

Importing Parent-child Data When the Parent Key is a Generated Value

Example: How to Transform a Parent-Child XML Document to the Required Import Structure

Example: Simple XML Import From Application Table

Example: Direct XML Import Verifying the Original Values

Example: Constraint Processing an XML Import