Skip to Content

Scenario Summary

In the design :

Declare the
target data type in-sync with the XML required as regards to the data, meaning
each node in the XML would become a node in the target data type. The required
XML will be derived within the payload using hard coded values for tags and
mapping logic to populate the values.

In the configuration :

File
content conversion would be used to suppress the unwanted nodes declared in the
target data types and only the nodes generated using the mapping will be
included in the target file. The file needs to be named with extension “.xml”.

Sample Scenario to Generate Generic XML : Design

Let us consider a case in which it is required to generate an XML file that looks as below.

image

As observed, the standard name space tags etc are not present in this target XML. This can be achieved through message mapping where the XML tags (For eg: First and Second lines in the screen shot shown above) are passed as constants and the variable content in the XML (for eg : Location ID values etc) are generated using the mapping logic and hence the target XML file is generated

within the XML payload

.

The target data type is declared as shown below and the XML tags are mapped to constants.

image

image

image

The tags in between for Eg: the field “

Status

” in the target Data Type under the node

“Location”

needs to be mapped as shown below.

image

image

image

Thes tags will also need to be appropriately closed using the similar logic of passing constants.We would need to ensure that the tags etc are closed properly.Even otherwise it can be validated once the XML file is generated.

Sample Scenario to generate XML: Configuration

Now to surpass the tags present in the target message we need to use file content conversion as shown below. Name the file with extension as “.xml “, and just mention the nodes to be included along with the field names as shown below.Naming the file with “.XML” extension is significant as only this will ensure autoformatting of the xml when it is opened.

image

This ensures that there are no standard XI tags and only the tags generated by the message mapping are present in the file. Now the XML file looks the way you want. The same logic can be applied for HTML files also. We need to map the tags to constants and the repetitive values to variables from the source and the file needs to be named with “.html” extension.

As you can see the key to generate the XML is the way the Target Data Type is declared.

As a generic rule it can be remembered that to generate a particular line in the target file, we would require a node in the target data type and for repetitive nodes, we can manipulate the occurences.Once we are familiar with this approach we can combine one or more nodes into the same mapping as done in the case of the field

“Location ID”.

Thus we can go on to generate any html or xml File as output without having to use XSLT.

To report this post you need to login first.

1 Comment

You must be Logged on to comment or reply to a post.

Leave a Reply