JobDataXml class
Package: com.tecit.TFORMer.Printing
Provides access to JobDataXml (a XML file that serves as JobData for a Job).
Usage and notes
Overview
XML files provide DataField values for generating output. Use JobDataXml to supply the file as the JobData of a Job.
The XML file must use one of the supported formats described below.
An optional XSLT file may be used to transform the XML file handed to TFORMer into one of the supported XML file formats.
The following XML formats can be used:
Generic XML Format (Variant 1)
<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>
Name | Description |
|---|---|
Root | This is the root element. It encloses all other elements of the XML-file. |
Records | This element encloses all records. |
Record | This element represents one Record. Within a Record the single DataField-values are defined. |
V | Data-Element. This element defines the name and the value of the DataField. |
DataFieldName | Name of the DataField (must be unique within a Record). |
Value | The actual value of the DataField. |
The elements can be named arbitrarily. This means the terms Root, Records and Record can be selected at will. Only the order of the element-nodes is decisive: TFORMer interprets the lowest level of the XML-file as name/value pairs for data-fields, superordinate nodes always correspond to records.
Generic XML Format (Variant 2)
Variant 2 is comparable to variant 1, but instead of using the syntax <V Name="DataFieldName">Value</V> you can specify DataField-values using the following syntax:
<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>
XML Files Exported by Microsoft® Access
<?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>
Internal XML Format
TFORMer Designer uses this format to store DataField name/value pairs.
<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>
<ImportedVariables/>
</Form>
</PSData>
Name | Description |
|---|---|
PSData | This is the root element. It encloses all other elements within the XML-file. |
Form | This element encloses all records for one FormLayout. It must be specified only once. |
Records | This element encloses all records to be printed. It must be specified only once. |
Record | This element encloses all data-fields for one Record. For each Record there is one (optional) attribute named |
V | Data-Element. This element consists of the DataField-name (attribute |
DataFieldName | Name of the DataField (must be unique within a Record). |
Value | The actual value of the DataField. |
ImportedVariables | Used internally by TFORMer. |
Example
The following example selects an XML input file.
// Create a new JobData instance.
// Here we import a XML file (must comply with the supported XML schemes)
JobDataXml jobData = new JobDataXml("path/data.xml");
// Assign the JobData to the Job
printJob.setJobData(jobData);
More Information
For a general description see JobData.
See also
Note
Thread-safety: A single instance of this class must not be used by different threads.
Inheritance and related types
Base types: JobData
Inherited members (4)
Constructors
| Member | Description |
|---|---|
| JobDataXml() | Constructor for JobDataXml. |
| JobDataXml(String) | Constructor for JobDataXml. |
Methods
| Member | Description |
|---|---|
| getFilename() | Gets the name of the XML input file. |
| getRecordCopyDataField() | Gets the name of the DataField which specifies the number of Record copies. |
| getRecordCopyDataFieldIsXMLAttribute() | Gets if the RecordCopyDataField specifies the name of an XML-attribute field. |
| getXsltFilename() | Gets the XSLT filename (optional). |
| getXsltTfcFilename() | Gets the XSLT TFC filename (optional). |
| setFilename(String) | Sets the name of the XML input file. |
| setRecordCopyDataField(String) | Sets the name of the DataField which specifies the number of record copies. |
| setRecordCopyDataFieldIsXMLAttribute(boolean) | Sets if the RecordCopyDataField specifies the name of an XML-attribute field. |
| setXsltFilename(String) | Sets the XSLT filename (optional). |
| setXsltTfcFilename(String) | Sets the XSLT TFC filename (optional). |