Challenge #195: XML Parsing
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
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."
- Labels:
- Advanced
- Data Analysis
- Difficult
- Parse
- Preparation
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Looking forward to seeing other people's more... elegant... solutions but this seems to get the job done and match the output!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Here's my results. Haven't gotten to play too much with XML parsing, but I'm familiar with the structure of XML files.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
I joined two XMLs child parses to reach the result.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
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!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
My output has the same records but in a slightly different order...