TFORMer SDK - NET 8
Public Member Functions | Properties | List of all members
JobDataXml Class Reference

Provides access to JobDataXml (a XML file that serves as JobData for a Job). More...

Public Member Functions

 JobDataXml ()
 Constructor for JobDataXml. More...
 
 JobDataXml (string filename)
 Constructor for JobDataXml. More...
 

Properties

string Filename [get, set]
 Gets/Sets the name of the XML input file. More...
 
bool HandleEscapeSequences [get, set]
 Gets/Sets a flag indicating whether escape sequences in DataField values like \n or \x40 should be translated by TFORMer SDK. More...
 
string RecordCopyDataField [get, set]
 Gets/Sets the name of the datafield which specifies the number of record copies. More...
 
bool RecordCopyDataFieldIsXMLAttribute [get, set]
 Gets/Sets if the RecordCopyDataField specifies the name of an XML-attribute field. More...
 
bool ReuseValues [get, set]
 Gets/Sets a flag indicating whether DataField values should be reused in consecutive Records. More...
 
string XsltFilename [get, set]
 Gets/Sets the XSLT filename (optional). More...
 
string XsltTfcFilename [get, set]
 Gets/Sets the XSLT TFC filename (optional). More...
 

Detailed Description

Provides access to JobDataXml (a XML file that serves as JobData for a Job).

Overview

The JobDataXml enables TFORMer SDK to use XML-files as JobData for printing a Job.

The data in the specified XML file provides the values of the DataFields. The XML file must comply with the formats recognized by TFORMer (see 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>
<V Name="DataFieldName1">Value</V>
<V Name="DataFieldName2">Value</V>
<V Name="DataFieldName3">Value</V>
</Record>
<V Name="DataFieldName1">Value</V>
<V Name="DataFieldName2">Value</V>
<V Name="DataFieldName3">Value</V>
</Record>
:
Further Data Records
:
</Records>
</Root>
Provides access to a Record.
Definition: JobDataRecordSet.cs:66
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>
<DataFieldName1>Value</DataFieldName1>
<DataFieldName2>Value</DataFieldName2>
<DataFieldName3>Value</DataFieldName3>
</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 Copies. If this attribute is missing it defaults to 1 – meaning that this Record is used once. If you want to use the same data for multiple records you can specify the number of copies using this attribute.
V Data-Element. This element consists of the DataField-name (attribute name) and the value.
DataFieldName Name of the DataField (must be unique within a Record).
Value The actual value of the DataField.
ImportedVariables Used internally by TFORMer.

Example

Assume a suitable XML-file is available. The corresponding call to create the JobData and to assign it to a Job is as follows:

// 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.JobData = jobData;
Provides access to JobDataXml (a XML file that serves as JobData for a Job).
Definition: JobDataXml.cs:20
JobDataXml()
Constructor for JobDataXml.
Definition: JobDataXml.cs:35

More Information

For a general description see JobData.

See also
JobData
Note
Thread-safety: A single instance of this class must not be used by different threads.

Constructor & Destructor Documentation

◆ JobDataXml() [1/2]

Constructor for JobDataXml.

Initializes a new instance of the JobDataXml class.

See also
JobDataXml

◆ JobDataXml() [2/2]

JobDataXml ( string  filename)

Constructor for JobDataXml.

Initializes a new instance of the JobDataXml class.

Parameters
filenameThe name of the XML input file
See also
JobDataXml, Passing Files

Property Documentation

◆ Filename

string Filename
getset

Gets/Sets the name of the XML input file.

Returns
The name of the XML input file
See also
JobDataXml, Passing Files

◆ HandleEscapeSequences

bool HandleEscapeSequences
getsetinherited

Gets/Sets a flag indicating whether escape sequences in DataField values like \n or \x40 should be translated by TFORMer SDK.

Returns
true if escape sequences in DataField values are translated
See also
JobData, Escape Sequences

◆ RecordCopyDataField

string RecordCopyDataField
getset

Gets/Sets the name of the datafield which specifies the number of record copies.

TFORMer SDK allows you to specify how often one Record of a JobData should be used for printing. This property specifies which DataField specifies the number of copies for each Record of the JobData.

Returns
The name of the DataField which holds the number of Record copies
See also
JobData, DataField

◆ RecordCopyDataFieldIsXMLAttribute

bool RecordCopyDataFieldIsXMLAttribute
getset

Gets/Sets if the RecordCopyDataField specifies the name of an XML-attribute field.

Returns
TRUE if the RecordCopyDataField specifies the name of an XML-attribute field.
See also
JobData, DataField

◆ ReuseValues

bool ReuseValues
getsetinherited

Gets/Sets a flag indicating whether DataField values should be reused in consecutive Records.

Returns
false if DataField-values should be cleared between Records
See also
JobData, DataField

◆ XsltFilename

string XsltFilename
getset

Gets/Sets the XSLT filename (optional).

Remarks
If specified, this XSLT file is used to transform the XML file handed to TFORMer SDK into one of the supported XML file formats (see JobDataXml).
Returns
The XSLT filename, null if not used
See also
JobDataXml, Passing Files

◆ XsltTfcFilename

string XsltTfcFilename
getset

Gets/Sets the XSLT TFC filename (optional).

Returns
The XSLT TFC filename, null if not used
Remarks
A TFC file (TFORMer command file) may be used to modify an existing FormLayout based on current input data.
Attention
Internal usage only, the current implementation should not be used!
See also
JobDataXml, Passing Files

© 2006-2023 - all rights reserved by TEC-IT Datenverarbeitung GmbH
Generated on Thu Dec 28 2023 18:45:19 for TFORMer SDK - NET with doxygen 1.9.4