Community Spring Cleaning week is here! Join your fellow Maveryx in digging through your old posts and marking comments on them as solved. Learn more here!

Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.
SOLVED

Parsing Xml

RonGatmaitan
8 - Asteroid

Hi,

 

I'm trying to parse a quite-complex-for-a-newbie xml file and I'm having a pretty hard time.

 

I basically have to access.

 

ReadBuyerHeader/DataSpace/BuyerHeader/Name (Line 32)

ReadBuyerHeader/DataSpace/BuyerHeader/EntityCode/DisplayID (Line 22)

ReadBuyerHeader/DataSpace/BuyerHeader/Location/Address/Address Line(1) (Line 36)

ReadBuyerHeader/DataSpace/BuyerHeader/Location/Address/Address Line(2) (Line 37; I guess this would almost be the same as accessing Address Line 1)

ReadBuyerHeader/DataSpace/BuyerHeader/Location/Address/CountryCode (Line 41; I guess this would almost be the same as accessing Address Line 1)

 

among other fields, but I guess I could derive the rest if I could just access these. Anything to get me started. There are too few samples on the internet and those that are available just don't cut it. That first line is already messing things up as the samples do not have that. I've tried to do quite a lot of trials and errors. I'm trying to get the most optimal solution for this.

 

Thank you very much in advance.

3 REPLIES 3
Adrian_T
Alteryx
Alteryx

Hey @RonGatmaitan,

 

The XML Parse Tool should get you started here - see below screenshot and sample workflow. Depending on your desired output you can further manipulate the output.

 

Adrian_T_0-1671163944512.png

 

RonGatmaitan
8 - Asteroid

Hi @Adrian_T,

 

Thanks so much for your very simple solution! Made my life SO MUCH easier!

My initial solution was to drill down the nodes one by one and then filter the unnecessary nodes using the Select tool.

 

RonGatmaitan_0-1671177950221.png

 

I have just a few more question, please. And I would set your answer to the solution - whether you are able to answer these or not.

 

1. The node Name appears quite a few times. How do I get which particular one I need? Do I use my original solution, just for this one case, just to make sure I'm accessing the right node?

2. How do I get it to return 1 row? Is the Join tool the best one to use for this?

3. I would, most probably, be getting these files from an AWS Bucket. The output needs to be 1 file with all the records of the necessary fields. Would an iterative macro be the best to use?

 

Thank you very much! Big help!

RonGatmaitan
8 - Asteroid

Sorry! I've wrongly set my answer as solution, instead of @Adrian_T's! How do I undo this?

Labels