TemplateTag element of a template definition file

Template definition files use the TemplateTag element and the TemplateDocument element. Several TemplateTag elements can be defined for each inbound XML message. Each TemplateTag element must be linked to a TemplateDocument element using the name attribute. The value that is associated with the name attribute should match the value of a TemplateTagName subelement within a TemplateDocument element that is defined within the template definition file.
Each TemplateTag element contains a list of tag definitions in the Tag subelement. The Tag element can contain the following five attributes:
XPath
The path of the XML element, relative to the StartElement indicated in the TemplateDocument. The XPath element is the key to finding the field name of the name-value pair. The following examples demonstrate the value that can be used for the XPath attribute:
  • E1/E2 - Element E2 is nested within element E1.

    XPath='Address/ZipCode'

  • E1/E2/E3 - Element E3 is nested within element E2, which is nested within element E1.

    XPath='ContactInfo/Address/ZipCode'

  • E3@a1 - The attribute a1 is nested within element E3.

    XPath='InvoiceInfo@InvoiceType'

    The InvoiceType attribute can be used to indicate which type of invoice the message applies.
  • E4[1] - The first instance the element E4. There can be multiple instances of E4. For example, you can use this format when you have multiple lines of an address. Each line of the address is contained in a separate tag element.
  • E5[@2="value 2"] - An instance of element E5, where the attribute a2 within E5 is equal to "value 2".

    XPath='InvoiceInfo[@InvoiceType="ShippingInvoice"]

    E5[@a1="value1"][@a2="value 2"] - The instance of element E5, where the attribute a1 of E5 is equal to '"value1", and the attribute a2 of E5 is equal to "value 2".

XPathType
The type of element that is indicated in the XPath. This attribute indicates how the XML element is to be processed by the XML parser. The following types are supported as values for the attribute.
PCDATA
The element or the attribute of the element contains raw, inbound data that is processed and returned in a name-value pair. This type is the default value for the XPathType.
EMPTY
The element is empty or contains data that can be ignored. No name-value pair is returned for this element.
REPEAT
The element can have multiple instances. The PCDATA for each element is returned in a name-value pair.
ATTRIBUTE
If the element field name is determined by the value of an attribute, this attribute should have ATTRIBUTE type.
VECTOR
A new hash table is appended to the Vector, and all name-value pairs that are generated for subelements are put into the new hash table.
USERDATA
Indicates a user-defined element. The element has an attribute that is called name whose value is the field name. The data of the element is returned in a name-value pair.
Field
The field name of the name-value pair that is put into the TypedProperty. The value for this attribute should match the name of a parameter that is used by the called command.
FieldType
The type of the data field. The field type can be String or Date (ISO 8601 Date format). The default value is String.
FieldInfo
Indicates the TypedProperty into which the name-value pair is to be placed. The default value is Data. If you want to put the name-value pair into more than one TypedProperty, you must specify more than one of the following values, separated by a comma:
Data
The name-value pair is put into the request properties map of the CommandProperty object that contains arguments for the command.
Control
The name-value pair is put into the execution properties map of the CommandProperty object that contains control information for the command, such as USERID or PASSWORD. These name-value pairs are typically used before the actual business logic execution such as user validation/access control.
Command
The name-value pair is used to determine which command is to be called. The generated name-value pairs are used in the CommandMapping element of the TemplateDocument element.

If the XPath element is not found within the tag template, the XPath in the XML message is used as the field name and the XPathType is PCDATA. A name-value pair is generated using XPath as the field name.

For an example of how the TemplateTag element is used, refer to the sys_template.xml file.