Advent of Code is back! Unwrap daily challenges to sharpen your Alteryx skills and earn badges along the way! Learn more now.
Free Trial

Weekly Challenges

Solve the challenge, share your solution and summit the ranks of our Community!

Also available in | Français | Português | Español | 日本語
IDEAS WANTED

Want to get involved? We're always looking for ideas and content for Weekly Challenges.

SUBMIT YOUR IDEA

Challenge #37: Parsing a Raw XML File

joshuaburkhow
ACE Emeritus
ACE Emeritus

Always good to know XML tool!

Joshua Burkhow - Alteryx Ace | Global Alteryx Architect @PwC | Blogger @ AlterTricks
terry10
12 - Quasar

Trial and error with the XML parsing tool, but I got it to work eventually. 

 

Spoiler
ss 37.PNG
Sylvana
8 - Asteroid

My solution without a "Parse tool".

Spoiler
 

Used one RegEx tool, cleaned up the data and combined it after a CrossTab tool.

 
Jean-Balteryx
16 - Nebula
16 - Nebula

Here is my solution !

cc000072
8 - Asteroid

Here is my solution

Spoiler
WeeklyChallenge_Ryohei_37.JPG
deviseetharaman
11 - Bolide
Spoiler
 
jarrod
ACE Emeritus
ACE Emeritus

Was thinking python was going to be a bit easier to parse, but couldn't get it to work out how i wanted, went back to xml tool (which can be very tedious with nested data)

 

Edit: found i had to use json.dumps() for the final cleansing of the data in python

 

 

Spoiler
jarrod_0-1590773725245.png

 

 
from ayx import Alteryx
import json
import xmltodict

df = Alteryx.read('#1')

df['json'] = df.apply(lambda x: 
                      json.dumps(
                          xmltodict.parse(
                              x['customer_OuterXML']))
                      ,axis=1)
Alteryx.write(df,3)

handled the json cross tab outside of python, but that could likely be handled just the same within python all the same. 

 #SnakingMyWayThruChallenges

DavidLane
8 - Asteroid

Took me quite a long time as I am not familar with XML parsing. My solution felt pretty clumsy, so I reckon there are easier ways to do this.

 

Spoiler
DavidLane_0-1591178844916.png

 

maazinh
8 - Asteroid

Not very comfortable at all with XML parsing

AngelosPachis
16 - Nebula

That was a bit messy with quite a few manual renaming going on inside the Join tool to get the names exactly the same. Still managed to get the right result

 

Spoiler
Annotation 2020-06-16 132032.png