Develop > Controller layer > Integrate with back-end systems and external applications > Inbound services > Message mappers


TemplateTag element of a template definition file

The TemplateTag element is used, along with the TemplateDocument element, in the template definition file. Several TemplateTag elements can be defined for each inbound XML message. However, each TemplateTag element must be linked to a TemplateDocument element using the name attribute. The value associated with the name attribute should match the value in the TemplateTagName sub-element of a TemplateDocument element defined with the template definition file.

Each TemplateTag element contains a list of tag definitions in the Tag sub-element. 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. Examples of XPath are:

E1/E2 Element E2, which is nested inside element E1.

The following is an example of this type of path...

XPath='Address/ZipCode'
E1/E2/E3 Element E3, which is nested inside element E2, which is nested inside element E1.

The following is an example of this type of path:

XPath='ContactInfo/Address/ZipCode'
E3@a1 The attribute a1 in element E3.

The following is an example of this type of path:

XPath='InvoiceInfo@InvoiceType'

In this case, the InvoiceType attribute may be used to indicate which one out of a variety of invoice types the message applies to.

E4[1] The first instance of element E4. There can be multiple instances of E4. For example, you could use this format where you have multiple lines of an address. Each line of the address would be contained in a separate Tag element.
E5[@a2="value 2"] An instance of element E5, where the attribute a2 of E5 equals to "value 2". For example, you could use the following format:

XPath='InvoiceInfo[@InvoiceType="ShippingInvoice"]
E5[@a1="value1"][@a2="value 2"] The instance of element E5, where the attribute a1 of E5 equals to '"value1", and the attribute a2 of E5 equals to "value 2".

XPathType

The type of element indicated in the XPath. This attribute indicates how the XML element should be processed by the XML parser. The supported types are:

PCDATA

The element or the attribute of the element contains raw, inbound data that will be processed and returned in a name-value pair. This 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. Each element's PCDATA 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 will be appended to the Vector, and all name-value pairs generated for sub-elements will be put into the new hash table.

USERDATA

Indicates a user-defined element. The element has an attribute 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 which will be put into the TypedProperty. This should match name of a parameter used by the called command.

FieldType

The type of the data field. The field type could be String or Date (ISO 8601 Date format). String is default.

FieldInfo

Indicate the TypedProperty into which the name value pair should be placed. Data is the default.

To put the name value pair into more than one TypedProperty, specify more than one of the values listed below, separated by a comma:

Data

The name-value pair will be put into the a commandProperty object which contains arguments for the command.

Control

The name-value pair will be put into a messageProperty which contains control information for the command, such as USERID or PASSWORD

Command

The name-value pair is used to determine which command should be called. The generated name-value pairs are used in the CommandMapping element of the TemplateDocument element.

If the element XPath is not found in the tag template, the XPath in the XML message will be used as the field name, and the XPathType is PCDATA, generating a name-value pair using XPath as the field name.

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


Related concepts

Message classification


+

Search Tips   |   Advanced Search