This site uses different types of cookies, including analytics and functional cookies (its own and from other sites). To change your cookie settings or find out more, click here. If you continue browsing our website, you accept these cookies.
We're actively looking for ideas on how to improve Weekly Challenges and would love to hear what you think!Submit Feedback
You never know where one will come across an interesting challenge.
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."
Looking forward to seeing other people's more... elegant... solutions but this seems to get the job done and match the output!
Here's my results. Haven't gotten to play too much with XML parsing, but I'm familiar with the structure of XML files.
This one was pretty easy. But I used XML a lot when I career-changed into programming.
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!
My output has the same records but in a slightly different order...