Posts

Showing posts with the label Bean

Parsing a JSON String and Converting it to XML in TIBCO

Image
If you have the REST & JSON Plug-in for TIBCO BusinessWorks, parsing and rendering a JSON string into XML is a straightforward task. We are often using XML in TIBCO, because XML is the most common format that is used to transform data using XSLT and XPath language. There are two ways we can parse and render JSON text: using an XML Schema, and using Java classes. Of course, XML Schema is already very handy, as we can always easily create one in TIBCO Designer. But, before we go to why we need to use Java classes, we need to examine first the nature of an XML Schema. An XSD describes the XML document in a strictly structured manner, which means that the sequence and nesting of the elements are important. However, for JSON, we cannot rely on the order of the elements, and we cannot force JSON to be that way. It’s just its character, and it maintains itself as an unordered collection of zero or more name/value pairs. That said, we cannot expect a JSON message to conform to the sp...

Using XML To Java in TIBCO BW

Image
There are cases when it is preferable to use Java code instead of XSLT when doing a complex string manipulation. For example, you would like to produce a single string from the different segments of an XML. You can do this by using XML To Java activity in TIBCO. Suppose you have the following XML: <?xml version = "1.0" encoding = "UTF-8"?> <Employees xmlns = "http://xmlns.tibco.com/javaschema/javaschema.Employees"> <Employee> <Age>24</Age> <Level>2</Level> <Name>Mark Cruz</Name> <Role>Technology Consultant</Role> <Skill>Java</Skill> <Skill>TIBCO</Skill> <Skill>Ruby</Skill> </Employee> <Employee> <Age>25</Age> <Level>1</Level> <Name>John Cruz</Name> <Role>Technology Consultant</Role> <Skill>TIBCO BW</Skill> <Skill>PHP</Skill> ...