While developing processes in TIBCO designer, Parse XML and Render XML activities are widely used. There is often a question in minds of people who are new to TIBCO development that “What is the difference between Parse XML and Render XML activity?”.
Parse XML task is used when you have an XML document stored in a string or binary field. This activity produces a tree representation of the XML that can be used by subsequent activities in the flow.
On the other hand, Render XML activity in TIBCO designer does opposite to Parse XML activity; i.e. it takes an XML tree for a specified schema and converts it to a string or binary element that contains the XML document.
Example of Using Parse XML and Render XML activity in TIBCO designer:
In our example we will use both Parse XML and Render XML activities in a process. We have a XML file stored in a text file with the contents as below:
<?xml version=”1.0″ encoding=”utf-8″?>
We create XML Schema (XSD) in our project Scheme folder for this XML file as shown below:
We create a new process ParseAndRender with both ParseXML and RenderXML activities as shown below:
Read File activity is used to read the XML string data from a text file Employee.xml. In the Parse XML activity configuration, we specify text as Input Style.
In ParseXML input tab, we map Text Content of Read File activity to its XMLString field.
In Output editor tab of Parse XML activity configuration, we select XML Schema (XSD) which we created as Employee.xsd for our example project.
After choosing this xml scheme in output editor, we can see that output of Parse XML activity is based on this schema as shown in its Output tab:
In Render XML activity configuration, select Text as output style as shown below:
In Input Editor tab of Render XML activity, select Employee.xsd XML schema.
In Render XML input, map output of Parse XML by using “Make a copy of” radio button. This will map Employee details to relevant XML output fields of Render XML activity.
Output of Render XML activity is a XML String containing XML data in text format.
Now we are done with configuration of all process activities. Its time to test the process.
Load the process in Designer Tester and observe the output of Parse XML and Render XML activities. As shown below, ParseXML activity output is showing output as XML structured data based on the text read from file by Read File activity.
And below you can see that RenderXML activity has output as a string with that XML data in it.