XML Upload Adaptor

Updated Oct 30, 2020

The XML Upload Adaptor allows data to be processed whenever a file is uploaded from the Data Stream page. 

Below you will find details on how to configure this adaptor. 

XML Upload Adaptor

1. Select the XML Upload adaptor and add sample data

Once you select the XML Upload adaptor, the first step is to enter a sample of your data so that K3 can assist you in configuring the route. Click the Add Sample Data button to begin.

2. Upload or paste sample data 

Sample data can be input by either uploading a file or pasting data into the box on the left.

3. Review uploaded data and determine XMLPath

Once sample data is uploaded, K3 will attempt to determine all of the fields for your dataset. The right panel will tell you how many fields were parsed for a particular XPath. The CONFIGURE FIELDS button will highlight for the XPath that is most likely to be of interest.


Click the CONFIGURE FIELDS button for the appropriate XMLPath to move on to the next step.

4. Select fields to capture

The Configure Fields step allows  you to select the fields from the XML sample data  to include. The fields are outlined on the left side of the screen. Clicking a field will move it to the right panel, indicating that this is a field that should be parsed.


K3 will display an example field name derived from the path which can be modified. This is the field name that will show up in K3, so reviewing and providing clear field names is recommended. The XPath used to parse the field will be displayed and in most cases should not be modified.


Note that K3 makes its best guess at the field types, so you might need to make some modifications based on your knowledge of the data.


Once you are satisfied, click OK in the bottom right to move on.


As ann additional note, you can click the Add All Candidates  link to add all parsable fields rather then selecting each field.

Configuration Parameter Description
Field Name This is the K3 field name corresponding to a field in your XML file. This is the name of the field that will be used in the K3 Source data. K3 will default a field name which you can modify. 
Field Type This is the K3 field type corresponding to a column in your XML file. K3 will recommend a field type, which you can modify.
XPath This is the XPath statement used to parse this specific field based on the XML file. It is not recommended to change this unless you have a good understanding of XPath parsing.

5. Select Metadata fields to capture

Once you have selected the detail fields to capture from the XML, you might have the option to select Metadata or header level fields to parse.  Click the Configure Meta XPaths ($) to start this process.

 

Select the metadata fields desired and specify the name and data types just as you did in the previous step.

 

Configuration Parameter Description
Field Name This is the K3 field name corresponding to a filed in your XML file. This is the name of the field that will be used in the K3 Source data. K3 will default a field name which you can modify. 
Field Type This is the K3 field type corresponding to a column in your XML file. K3 will recommend a field type, which you can modify.
XPath This is the XPath statement used to parse this specific field based on the XML file. It is not recommended to change this unless you have a good understanding of XPath parsing.

6. Date Formats and Finalizing Configuration

The final step is to determine Date/DateTime formats, which K3 uses to parse strings representing Date/DateTime values. K3 will attempt to suggest formats that are appropriate for your data, but you might need to provide custom formats by clicking the + Add link below the Date/Date Time sections. Keep in mind that multiple formats are allowed and K3 will attempt to parse any value in the order that the formats are specified.


If you find that Date/DateTime field values are missing in Data Stream, you might need to return to this page to review the formats specified below. 

Configuration Field Value
Date Enter the format of Date fields in the XML so that K3 can parse it properly.

Examples:
yyyy-MM-dd -> 1978-05-28
yyyyMMdd -> 19780528
MM/dd/yyy -> 05/28/1978
Date Time Enter the format of DateTime fields in the XML so that K3 can parse it properly.

Examples:
yyyy-MM-dd'T'HH:mm:ss.SSSZ -> 1978-05-28T09:07:21.201-07:00
yyyy-MM-dd'T'HH:mm:ss.SSS -> 1978-05-28T09:07:21.201
yyyy-MM-dd'T'HH:mm:ssZ -> 1978-05-28T09:07:21-07:00

7. Automatic source field import

Once you create the route, you will be navigated to the "Source Fields" dialog with your fields ready to be created. Click the SAVE button to create the fields.

8. Uploading Data for Processing

Once an upload route is configured you can upload data to that that route in the Data Stream. Select Data Stream for the route you have created and click the ellipsis on the right hand side of the data table to upload your file. 

Previous Article JSON Upload Adaptor