This step converts the XML data to XLS file format.
- xmlVariable – variable / global that holds the xml data
- xlsFilePath – variable / global that holds the output file path on the server
- xmlNodeName – mention XML node to parse or considers the xml data between <root> and <\root> tags to parse by default
- workSheetName - renames the worksheet with this name (not mandatory)
- writeColHeadings - write column names (On / Off)
- True – step executed successfully
- False – step failed to execute
Let’s build and execute the “XmlToXlsDef” example.
- Create a new definition called “XmlToXlsDef”
- Select the definition and click the “design” button
- Drag a “XmlToXls” step from the toolbox
- Connect the dots between the start and “XmlToXls” step
- Configure variable.FilePath as string
- Click on the “readFile” step to configure its “Settings” properties. Provide a name to the step. Provide the variable/global which holds the XML data. Provide the file path info to store the XLS file.
- Click on the “readFile” step to configure its “Advanced” properties. Provide the XML node info for the XML data. Provide the worksheet name. Select “On” to include column names for the worksheet.
- The “Logging” setting configuration is necessary for documentation and also measure the workflow progress and the percent complete. This is acheived by configuring the step state and percent fields individually as shown in the images below. Configure the “Logging” using the following 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.