XMLT Element Types

These elements appear in XMLT translation files , and specify the data to extract from an XMLT input files for various XMLT data structures . XMLT uses these structures to build the XMLT output file.

Note: Unless otherwise stated, the examples below would occur in a translation XML file based on XMLT.xsd. Examples from other types of files, e.g. input and output files, are indicated where used.

Element Type

Description

File

Each input file can contain multiple order/group records. The attributes of this element configure XMLT for various types of output.

Output files can be split if:

The resulting file will be greater than a configured size, or

The resulting file will contain more than one order (item).

 

Content

eltOnly

 

 

Order

Many

 

 

Model

Closed

 

 

Attribute Types

SplitFile

 

 

 

SplitType

 

 

 

SplitSize

 

 

Element Types

Header

Optional

 

 

Record

Required

 

 

Trailer

Optional

 

Related Elements

 

 

 

Example

An File element configures XMLT to split output files in order to obtain individual XML output files for each order item:

<File xmlns="x-schema:..\xmlt.xsd" SplitFile="True" SplitType="Item">

.
.
.

</File>

Header

(Optional) Specifies header information. XMLT uses this information to generate attributes for  the <File> header in the XML output file.

 

Content

EltOnly

 

 

Order

Many

 

 

Model

Closed

 

 

Attribute Types

Pattern

Required

 

Element Types

Attribute

Optional

 

Related Elements

File

 

 

Example

An Attribute element within a Header element extracts six characters from the default (0th) line of the header (the line starting with the letters "HEADR"), starting at offset 6 (the 7th character):

    <Header Pattern="HEADER">

      <Attribute DateFormat="YYMMDD">Date

        <Chunk Offset="6" Length="6"></Chunk>

        </Attribute>

    </Header>

The extracted text becomes a Date attribute in the Output XML file header, in YYMMDD format :

    <File Date="030310">

    .
.
.

Trailer

(Optional) Specifies trailer information and validates the input file.

 

Content

eltOnly

 

 

Order

 

 

 

Model

Closed

 

 

Attribute Types

Pattern

Required

 

Element Types

CountField

 

 

Related Elements

File

 

Example

An CountField element within a Trailer  element obtains seven characters from the default (0th) line of the trailer  (the line starting with the letters "TRAILR"), starting at offset 34 (the 35th character):

    <Trailer Pattern="TRAILR">

        <CountField CountExtra="2">

            <Chunk Offset="34" Length="7"></Chunk>

        </CountField>

    </Trailer>

The value obtained is adjusted by adding the CountExtra value,  2. XMLT compares the adjusted value with its internal count of the number of lines actually processed.

CountField

Specifies the number of lines in the input file, not including the header or trailer, for validation purposes. The number of lines actually processed by XMLT has to match this number (adjusted by the optional CountExtra attribute) or the translation fails.

 

Content

EltOnly

 

 

Order

Many

 

 

Model

Closed

 

 

Attribute Types

CountExtra

Optional

 

Element Types

Chunk

 

 

Related Elements

Trailer

 

Example

An CountField element within a Trailer element obtains six characters from the 0th line of the trailer (the line starting with the letters "TRAILR"), starting at offset 18 (the 19th character):

    <Trailer Pattern="TRAILR">

        <CountField>

             <Chunk Offset="18" Length="6" Line="0" Pad="False"/>

        </CountField>

    </Trailer>

XMLT compares the value obtained with its internal count of the number of lines actually processed.

Record

Specifies processing options for records.

Each line can be processed as an individual record, or data from multiple input lines can be collected as a single record,.

The number of characters to be collected for each record can be specified in cases where no end-of-line/line feed character is used in the input file.

 

Content

eltOnly

 

 

Order

Many

 

 

Model

Closed

 

 

Attribute Types

CollectLines

Optional

 

 

RecordLength

Optional

 

Elements Types

StartRecord

 

 

 

EndRecord

 

 

 

ItemType

Optional

 

 

GroupName

Optional

 

 

ItemData

 

 

Related Elements

File

 

Example

An Record element with no attributes (defaults to CollectLines=False) treats each line of input as a separate record. Note that the Chunk elements below have no Line attributes; the Item ID, at offset 10, and all attributes at offsets 243 and 249, are extracted from the same single input line.

<Record>

    <ItemType>ORDER

        <Chunk Offset="10" Length="17"></Chunk>

    </ItemType>

    <GroupName>Feature Codes</GroupName>

    <ItemData>

        <Attribute>Features

            <Chunk Offset="243" Length="5"></Chunk>

        </Attribute>

    </ItemData>

    <ItemData>

        <Attribute>Feature Code

        <Chunk Offset="249" Length="5"></Chunk>

        </Attribute>

    </ItemData>

</Record>

StartRecord

(Optional)

Specifies the characters that mark the start of a record in the input file. XMLT finds the record start marker by searching the input file for a string of characters, specified by the text content of this element, at a character offset specified by its associated Chunk.

Note: The record start defines line 0 for elements contained within the previous Record element.

 

Content

mixed

 

 

Order

 

 

 

Model

Closed

 

 

Attribute Types

 

 

 

Element Types

Chunk

 

 

Related Types

Record

 

Example

A StartRecord element defines that characters that mark the start of a new record.

The text content, e.g.  UH, marks the record start.

Chunk defines the offset and length of this marker.

    <Record CollectLines="True">

        <StartRecord>UH

            <Chunk Offset="8" Length="2"></Chunk>

        </StartRecord>
Lines, in the input file, where with the characters "UH" occur at the offset 8 (9th character) start a new record:

00000001UH01            GBB43D0930801000001

00000002UD01     5310   CNDSBAAATEST FUNCTION           000002.00000

00000003UD01     5310   CNDSBJ9XEC00040101904           000002.00000

00000006UT01            GBB43D09308010000004

00000007UH01            GBBW3D1511301000002

00000008UD01     5310   CNDSBAAATEST FUNCTION           000002.00000

00000009UD01     5310   CNDSBGJVEC00040101904           000002.00000

00000012UT01            GBBW3D15113010000004

EndRecord

 

(Optional)

Specifies the characters that mark the end of a record in the input file. XMLT finds the record end by searching the input file (downward from the current record start marker) for a string of characters specified by the text content of this element, at a character offset specified by its associated Chunk.

 

Content

mixed

 

 

Order

 

 

 

Model

Closed

 

 

Attribute Types

 

 

 

Element Types

Chunk

 

 

Related Elements

Record

 

Example

An EndRecord element defines that characters that mark the end of a the current record.

The text content, e.g.  UT, marks the end of the record.

Chunk defines the offset and length of this marker.

        <EndRecord>UT

            <Chunk Offset="8" Length="2"></Chunk>

        </EndRecord>
 

An example of the input file is shown above for StartRecord.

ItemType

(Optional)

Identifies a record as an item, e.g. as an order belonging to the ORDER Item Type, specifies the unique identifier for this specific instance of that Item Type.

The text content of this record identifies the name of the Item Type (or Item Type ID) for the item.

Note: The Item Type you specify must be defined in the TADB and PRT databases.

 

Content

mixed

Note: Text content, i.e. Item Type, must be all uppercase.

 

Order

 

 

 

Model

Closed

 

 

Attribute Types

 

 

 

Element Types

Chunk

 

 

Related Elements

Record

 

Example

An ItemType element identifies the following record as an item of the ORDER Item Type. The Chunk on the following line specifies a unique identifier (ABC12345X67890) for the current item at offset 9 (10th character) of line 1 of the current record.

    <Record CollectLines="True">

    <StartRecord>1

        <Chunk Offset="0" Length="1"></Chunk>

    </StartRecord>

    <ItemType>ORDER

        <Chunk Line="1" Offset="9" Length="14"></Chunk>

    </ItemType>

    

XML Output:

    <I IT="ORDER" Id="ABC12345X67890">

    .
.
.

    </I>

GroupName

(Optional)

Associates one or more Attribute elements as a group data portion of the current record. The text content of this record identifies the name of the group.

Note: The group name must be defined in the TADB database.

Group data can follow an ItemType  element or can follow a Record (or StartRecord) element directly.

If following the ItemType Element Type, the GroupName is associated with an order for that item type.

If the GroupName does not follow an ItemType,then the group represents data for a lookup table in the TADB database.

 

Content

Text Only

 

 

dt:type

String

 

 

Order

 

 

 

Model

Closed

 

 

Attribute Types

 

 

 

Element Types

 

 

 

Related Elements

Record

 

 

 

 

 

Example

An GroupName element identifies the following ItemData element as group data belonging to the TADB group Order Card.

    <ItemType>ORDER

        <Chunk Line="1" Offset="9" Length="14"></Chunk>

    </ItemType>

    <GroupName>Order Card</GroupName>

        <ItemData EachLine="False">

            <Attribute>pVIN

                <Chunk Line="4" Offset="28" Length="4" Pad="False" />

            </Attribute>

       </ItemData>

ItemData

Specifies TADB attributes for a particular TADB group.

 

Content

eltOnly

 

 

Order

Many

 

 

Model

Closed

 

 

Attribute Types

EachLine

 

 

Child Elements

Attribute

 

 

Example

An ItemData element specifies that each line of the current record represents a complete group record. Note that a Chunk belonging to this element doe not need to have a Line attribute; the line is specified by a previous StartRecord element.

<GroupName>Parts</GroupName>

    <ItemData EachLine="True">

        <Attribute>Base

            <Chunk Offset="12" Length="9"></Chunk>

        </Attribute>

         <Attribute>Prefix

             <Chunk Offset="21" Length="7"></Chunk>

        </Attribute>

     </ItemData>

Attribute

An Attribute element. This element specifies name and value for an "attribute."

Note: This element is used to generate both XML tag attributes and TADB group attributes, depending on the context in which you use it.

 

Content

mixed

Within a Header element, the content consists of:

 text - the name of an attribute for the output <File> tag, and

Chunk (one or more) - the value for this attribute.

Within an ItemData element, the content consists of:

text - the value of the output <A> tag's  AN attribute, and

Chunk (one or more) - the content for the output <A> tag.

Note:  The <A> tag occurs in the XML output  file generated by XMLT. It defines a TADB group element, not an attribute of an XMLT element.

Important:  The output file has its own set of tag elements, defined by the schema file POMS.xsd. You never code with POMS tags. They are discussed here only to provide a better understanding of how XMLT elements process your data.

 

Order

Many

 

 

Model

Closed

 

 

Attribute Types

DateFormat

 

 

Element Types

Chunk

 

 

Related Elements

Header, ItemData

 

Examples

An Attribute element within a Header element extracts six characters from the 0th line of the input header (the line starting with the letters "HEADR"), starting at offset 5 (the sixth character):

    <Header Pattern="HEADR">

        <Attribute DateFormat="YYMMDD">Date

        <Chunk Offset="5" Length="6" Line="0" Pad="False" />

        </Attribute>

    </Header>

These characters become a value for the Date attribute of the  <File> tag (the file header) in the XML output file:

    <File Date="030930">

Note that the output date is formatted as Year-Month-Day.

 

An Attribute element within an ItemData element extracts 14 characters from lines nine and ten of the current record (a record start marker defines line 0), starting at offset 10 (the eleventh character) in one case, and the first character in the other:

    <ItemData EachLine="False">

        <Attribute>PIN

            <Chunk Line="9" Offset="10" Length="5" Pad="False" />

            <Chunk Line="10" Offset="0" Length="9" Pad="False" />

        </Attribute>

    </ItemData>

These characters become the content of an <A> tag in XML output file. The text content of the Attribute element, "PIN" becomes a value for the  AN attribute of the <A> tag in the XML output file:

    <A AN="PIN">ABC12345X67890</A>

Chunk

Specifies a string of contiguous characters obtained from a single line of the input text file.

 

Content

Empty

 

 

Order

Many

 

 

Model

Closed

 

 

Attribute Types

Line

Optional, defaults to 0.

 

 

Offset

Required

 

 

Length

Required

 

 

Pad

Optional, defaults to False

 

Element Types

 

 

 

Related Elements

StartRecord, EndRecord, ItemType, Attribute, CountField

 

 

Example

A Chunk specifies a string of eight characters on input line 1, starting with the twenty-fourth character from the left.

   <Chunk Line="1" Offset="24" Length="8" />

Note: Line numbers start at 0. Numbering starts at

the line specified by the previous Header, StartRecord, or Trailer element.

More information

XMLT translation utility.