Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.
GELÖST

(Urgent! No idea yet) Parsing a nested xml file

tamluenwai
Meteor

I want to perform a XML parsing, and I would like to know each element they are under which parent element.

 

Expected output

NameValueParent Name
formidABC0123form
captchaMethodAA_Helloform
.........
trnidAA012363QPS2RTVSsubmit

 

Thanks so much !!

5 ANTWORTEN 5
kelvin_law1
Comet

Hi @tamluenwai 

 

Is this what you are looking for as output?

XMLTest.png

If yes, please find my workflow for your reference.

tamluenwai
Meteor

Hi kelvin, thanks for your help. The output of your workflow is closely fulfill my expected output.

 

But I got some limitation of my workflow:

 

For the input tools configuration,

I have to set the file format as "Extensible Markup Language (*.xml)", instead of "Comma Separated Value (*.csv). Here's the configuration and the output result of after executing the input tool.

q1.png

 

 

Subsequently, I have dragged a "XML Parse" tool after the "Input tool", and the configuration and output as follow:

q2.png

 

Therefore, I would like to know how can i perform the same result as your workflow based on this 2 limitation.

 

Again, thanks for your help. I have attached my workflow in this message down below for your references.

 

tamluenwai
Meteor

Hi Kelvin,

 

I got another xml file, with 3 different child "form", "submit", "data" under the parent "submission", I found that I am not able to obtain the same result by using your workflow. It seems that Alteryx cannot parse the XML with 3 different child elements?

 

I have attached the latest XML file in this message down below for your references. Thank you for your kind assistance, looking forward to hearing from you soon.

 

 

kelvin_law1
Comet

Hi @tamluenwai,

 

It's a little tricky to use the Input Tool for XML type with complicated XML format.

 

I have modified the workflow based on your requirements.  Couple things that I have changed here:

1. Changed the Input Tool for XML type with Return Root Element and Return Outer XML options checked.

2. Since it's a nested XML format, there will be an additional Submission element.  I used a Filter tool to filter that element out.

3. Used Regex to split the element into multiple rows.

 

Hope it works for your use case.

tamluenwai
Meteor

@kelvin_law1 

 

Thanks for your help, it works perfectly !!

Beschriftungen