Sybase 2 Barcode Reader User Manual


 
CHAPTER 14 Exporting and Importing XML Data
DataWindow Designer User’s Guide 409
Importing with a template
If the XML document or string from which you want to import data does not
correspond to the DataWindow column definition, or if you want to import
attribute values, you must use a template.
If a schema is associated with the XML to be imported, you must create a
template that reflects the schema.
For complex, nested XML with row data in an iterative structure, you may need
to design a structure that uses several linked DataWindow definitions to import
the data. Each DataWindow must define the structure of a block of iterative
data with respect to the root element. Importing the data into the DataWindow
objects would require multiple import passes using different import templates.
Defining import
templates
The XML import template can be defined in the Export/Import Template view
for XML. If you are defining a template for use only as an import template, do
not include DataWindow expressions, text, comments, and processing
instructions. These items are ignored when data is imported.
Only mappings from DataWindow columns to XML elements and attributes
that follow the Starts Detail marker in the template are used for import.
Element and attribute contents in the header section are also ignored. If the
Starts Detail marker does not exist, all element and attribute to column
mappings within the template are used for import. For more information about
the Starts Detail marker, see “The Detail Start element” on page 388.
Matching template
structure to XML
An XML import template must map the XML element and attribute names in
the XML document to DataWindow column names, and it must reflect the
nesting of elements and attributes in the XML.
The order of elements and attributes with column reference content in the
template does not have to match the order of columns within the DataWindow,
because import values are located by name match and nesting depth within the
XML. However, the order of elements and attributes in the template must
match the order in which elements and attributes occur in the XML. Each
element or attribute that has column reference content in the template must
occur in each row in the XML document or string. The required elements and
attributes in the XML can be empty.
If an element or attribute does not occur in the XML document, the
DataWindow import column remains empty.
The data for the DataWindow is held in the columns of the data table. Some
data columns, such as those used for computed fields, may not have an
associated control. To import data into a column that has no control reference,
add a child DataWindow expression that contains the column name.