Weekly Challenge

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

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

Submit Feedback
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.

Challenge #195: XML Parsing

Highlighted
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."

 

Highlighted
9 - Comet

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
Highlighted
Alteryx Certified Partner
Spoiler
wc 195.PNG
Highlighted
Alteryx Certified Partner

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

 

Spoiler
WC195.png
Highlighted
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
Highlighted
11 - Bolide

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

 

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

I joined two XMLs child parses to reach the result.

Highlighted
8 - Asteroid
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
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
Highlighted
Alteryx
Alteryx

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

Spoiler
RobertW_0-1577133384821.png