Converts the XML data into XLS file
Let’s build and execute the XmlToXlsDef example.
- Create a new definition called “XmlToXlsDef”
- Select the definition and click the “design” button
- Let’s define few string data type variables called “varXML” and “filePath”.
- Drag a XmlToXls step to the canvas, connect to start step and configure its properties
- Generate a new process instance. Initialize the varXML variable with the sample XML data shown below. The step shall process the raw XML data between the <root> <\root> elements or a specific node which is seen configured above in Advanced - XML nodes to be processed. This XML node can also refer to the root node (root) or specific node (node) in the XML data. Copy-paste the sample XML data to xmlVar variable to initialize. Typically, the varXML variable is initialized by other XML steps like (executesql, generatexml) in a process workflow. Execute this new process instance.
<root> <node> <to>firstname.lastname@example.org</to> <from>email@example.com</from> <heading>New social handle</heading> <body>Hi! We're here on Instagram now. Let's connect!</body> </node> <book id='bk101'> <author>Gambardella, Matthew</author> <title>XML Developer's Guide</title> <genre>Computer</genre> <price>44.95</price> <publish_date>2000-10-01</publish_date> <description>An in-depth look at creating applications with XML.</description> </book> <node> <to>firstname.lastname@example.org</to> <from>email@example.com</from> <heading>New social handle</heading> <body>Hi! We're here on Instagram now. Let's connect!</body> </node> </root>
- The step shall transform the XML data to XLS file on the server. The default Sheet1 worksheet is renamed with the value (TestSample) as configured above. Use the appURI and filePath variable values from the step property to download the XLS file.