XML Input
For a runnable .NET example, see Import XML data. The shared field-handling rules also apply.
TFORMer recognizes two XML format families for job data:
- Internal TFORMer XML. The
PSData/Form/Recordshierarchy stores records and data-field name/value pairs. ARecordmay use the optionalCopiesattribute; its default is one. - Generic XML. TFORMer uses the first element level containing field values as a record. A field name can be supplied in the
Nameattribute or, if that attribute is absent, by the field element's name. The parent elements form the record and records-container hierarchy; their names are not fixed. XML exported by Microsoft Access is one example of this element-per-field structure. This does not imply compatibility with a specific Microsoft Access version.
In every format, imported field names must match the data-field names in the form layout.
Internal TFORMer XML-Format
The XML format used internally by TFORMer must be available exactly as specified below:
<PSData>
<Form>
<Records>
<Record Copies="1">
<V Name="DataFieldName1">Value</V>
<V Name="DataFieldName2">Value</V>
<V Name="DataFieldName3">Value</V>
</Record>
<Record Copies="1">
<V Name="DataFieldName1">Value</V>
<V Name="DataFieldName2">Value</V>
<V Name="DataFieldName3">Value</V>
</Record>
</Records>
</Form>
</PSData>
Description:
| Name | Description |
|---|---|
| PSData | Required root element of the internal TFORMer XML format. It contains the Form element and all data in the file. |
| Form | Encloses all records for one form and must occur only once in an XML file. |
| Records | Encloses all records to be printed with the form and must occur only once in an XML file. |
| Record | Encloses the data fields for one record. Its optional Copies attribute defaults to 1 and can request multiple copies of the same data. |
| V | Data element consisting of the data-field name in the Name attribute and the actual value. |
| DataFieldName | Name of the data field; it must be unique within a record. |
| Value | Actual value of the data field. |
Generic XML-Format
Generic XML supports two field representations. In both variants, the names of the root, records-container, and record elements are arbitrary; their nesting order determines their roles. TFORMer interprets the lowest element level as data-field definitions and values, with the parent elements representing records and their container.
Field Names in Name Attributes
<Root>
<Records>
<Record>
<V Name="DataFieldName1">Value</V>
<V Name="DataFieldName2">Value</V>
<V Name="DataFieldName3">Value</V>
</Record>
<Record>
<V Name="DataFieldName1">Value</V>
<V Name="DataFieldName2">Value</V>
<V Name="DataFieldName3">Value</V>
</Record>
<!--
Further Data Records
-->
</Records>
</Root>
Description:
| Name | Description |
|---|---|
| Root | Encloses all data within the XML file. |
| Records | Encloses all data records. |
| Record | Describes one data record. Within a record, one value can be specified for each data field. |
| V | Data element consisting of the data-field name in the Name attribute and the actual data-field value. |
| DataFieldName | Name of the data field; it must be unique within a record. |
| Value | Actual value of the data field. |
Example:
<Root>
<Records>
<Record>
<V Name="ArticleName">Chair</V>
<V Name="ArticleNo">558963</V>
<V Name="ArticlePrice">110</V>
</Record>
<Record>
<V Name="ArticleName">Desk</V>
<V Name="ArticleNo">778920</V>
<V Name="ArticlePrice">150</V>
</Record>
<!-- Add more Record elements here. -->
</Records>
</Root>
Field Names as Element Names
Variant 2 uses the field name as the element name instead of <V Name="DataFieldName">Value</V>:
<Root>
<Records>
<Record>
<DataFieldName1>Value</DataFieldName1>
<DataFieldName2>Value</DataFieldName2>
<DataFieldName3>Value</DataFieldName3>
</Record>
<Record>
<DataFieldName1>Value</DataFieldName1>
<DataFieldName2>Value</DataFieldName2>
<DataFieldName3>Value</DataFieldName3>
</Record>
<!--
Further Data Records
-->
</Records>
</Root>
Microsoft Access XML-Format
The following Microsoft Access example uses one element per data field:
<?xml version="1.0" encoding="UTF-8"?>
<dataroot xmlns:od="urn:schemas-microsoft-com:officedata">
<tblTableName>
<DataFieldName1>Value</DataFieldName1>
<DataFieldName2>Value</DataFieldName2>
<DataFieldName3>Value</DataFieldName3>
</tblTableName>
<tblTableName>
<DataFieldName1>Value</DataFieldName1>
<DataFieldName2>Value</DataFieldName2>
<DataFieldName3>Value</DataFieldName3>
</tblTableName>
<!--
Further Data Records
-->
</dataroot>