We've recently made an accessibility improvement to the community and therefore posts without any content are no longer allowed. Please use the spoiler feature or add a short message in the message body in order to submit your weekly challenge.
6/17/21: We have completed maintenance for the Search functionality on the Community. If you are seeing any issues, please try to clear your cache first. If the issue persists please email Community@alteryx.com

Weekly Challenge

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

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

We're actively looking for ideas on how to improve Weekly Challenges and would love to hear what you think!

Submit Feedback

Challenge #195: XML Parsing

AYXAcademy
Alteryx
Alteryx

You never know where one will come across an interesting challenge.xml_brackets.png

 

The following was posted as a response to a post called "XML Parsing for Beginners".

 

"I have a file (a sample is included below) that contains information about an item. My task is to generate a list that associates the item identifier to the specific attributes, for example from this sample, I'd be looking for something along this sort of output table:

 

item_identifier | grade_level | subject | Depth of Knowledge | Bloom's Taxonomy | etc etc"

 

So, basically a table that has all of the <source><langstring> as the title and the <taxon><entry> as the value. Then to make things a little more complex, when you get to the <source><langstring>Standard, there are multiples with the same name but different values, and I need all the values."

 

EW
10 - Fireball

Looking forward to seeing other people's more...  elegant...  solutions but this seems to get the job done and match the output!

 

Spoiler
195 EW.PNG
Aaron_Harter
11 - Bolide
Spoiler
wc 195.PNG
Blake
12 - Quasar

my relationship with XML can be best described as 'love-hate' 

 

Spoiler
WC195.png
JReid
9 - Comet

Here's my results. Haven't gotten to play too much with XML parsing, but I'm familiar with the structure of XML files.

 

Spoiler
I took the strategy of defining my taxonomy and then choosing the two child fields I was interested in, which i found from taking the text into notepad++. There's probably a more dynamic solution if I had more than two fields, but this worked for the use case.

JReid_0-1577120329154.png
David-Carnes
11 - Bolide

This one was pretty easy.   But I used XML a lot when I career-changed into programming.

 

Spoiler
195.png
rmassambane
8 - Asteroid
Spoiler
195.PNG

I joined two XMLs child parses to reach the result.

BradWerner
11 - Bolide
Spoiler
New to XML parsing but was inspired by @rmassambane's screenshot to figure out how the tools were configured. Great idea!

195 Complete.png
jmt214
8 - Asteroid

This was my first time parsing XML. While I don't totally understand what's happening under the hood, I did get the answer with minimal Googling!

 

Spoiler
Capture.PNG
RobertW
Alteryx
Alteryx

My output has the same records but in a slightly different order...

Spoiler
RobertW_0-1577133384821.png