We’ve extended Inspire Early Bird Pricing until March 1. Register now and enjoy 20% off conference passes and 10% off training passes. P.S. Don’t forget to bring friends! When you sign up for five or more tickets, you get an extra 20% discount on conference passes. Learn more now.

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 #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
11 - Bolide

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
12 - Quasar

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

 

Spoiler
195.png
rmassambane
10 - Fireball
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