Steel Wheels has some data sources in XML format. This workshop illustrates the 3 data source options for retrieving XML data.
In this workshop, you will configure the following step:
Get data from XML
File
URI
Stream
Create a new Transformation
Any one of these actions opens a new Transformation tab for you to begin designing your transformation.
By clicking File > New > Transformation
By using the CTRL-N hot key
XML - File
In this workflow, an XML file is parsed via an X-path to retrieve the required dataset.
Get data from XML
This step provides the ability to read data from any type of XML file using XPath specifications.
Drag the ‘Get data from XML’ step onto the canvas.
Double-click on the step, and configure the following properties:
Click on the Content tab, and configure the following properties:
Click on the Fields tab, and then on the ‘Get Fields’ button.
Click OK.
Dummy
The Dummy step does not do anything. Its primary function is to be a placeholder for testing purposes. For example, to have a transformation, you need at least two steps connected to each other.
Drag a ‘Dummy’ step onto the canvas.
Create a hop from the ‘Get data from XML’ step.
Close the Step.
RUN Transformation
The workshop illustrates how to ingest an XML data source. The XML can either stream from:
a previous step - typically a URI
a file
stream - defined in a data stream field
Remember to disable the hops on the second workflow.
Click the Run button in the Canvas Toolbar.
Preview the data.
In this workflow, a URL to an XML data source is parsed via an X-path to retrieve the required dataset.
In this workshop we're going to pass the URL in a datastream field.
Ensure you have copied the URL into the clipboard for X path.
Generate rows outputs a specified number of rows. By default, the rows are empty; however, they can contain several static fields. This step is used primarily for testing purposes. It may be useful for generating a fixed number of rows, for example, you want exactly 12 rows for 12 months.
Drag the ‘Generate Rows’ step onto the canvas.
Double-click on the step, and configure the following properties:
The dataset is being parsed from a stream field xmlUrl that’s being passed on from the ‘Pass URL’ step.
Drag the ‘Get Data from XML’ step onto the canvas.
Create a hop from the ‘Pass URL’ step.
Double-click on the step, and configure the following properties:
Click on the ‘Content’ tab and configure the following properties:
Click on the ‘Fields’ tab and configure the following properties:
Click on the ‘Get Fields’ button.
The Dummy step does not do anything. Its primary function is to be a placeholder for testing purposes. For example, to have a transformation, you need at least two steps connected to each other.
Drag a ‘Dummy’ step onto the canvas.
Create a hop from the ‘Get data from XML’ step.
Close the Step.
RUN the Transformation
Remember to enable the hops and disable the hop in Workflow 1: XML - File
The workflow will fail .. do you know why.?
Click the Run button in the Canvas Toolbar
Check the logs.
Looks like Zone data type is alpha numeric = string instead of integer.
Change Zone data type to string and re-run transformation.