Hello. I've recently(maybe 3 or 4 days now?) started to learn ruby and rails and couldnt find a project to learn them with. So my firend texted me asking me to find him a free comic book organizer and I thought, "hey why dont i do that with rails?".
Hello. I've recently(maybe 3 or 4 days now?) started to learn ruby and rails and couldnt find a project to learn them with. So my firend texted me asking me to find him a free comic book organizer and I thought, "hey why dont i do that with rails?".
I think your code is simply iterating through each "name" element in the XML, regardless of whether it's the character's name or the name of something else within the data.
So you're outputting lines like this:
name: Jason
name: Keyop
name: Mark
... which are character names from "G Force to the Rescue!", but your code is also finding the "name" of that title (maybe it's the first appearance of one of the characters or something), so your code writes:
name: G Force to the Rescue!
I don't know Ruby, but presumably there's a way to say "just get me the <name> elements that are direct descendents of the <character> tag, rather than recursively searching down through the XML and finding all of them."
So i ended up trying a different xml parsing library and this gave me better resuls. I'm gonna tinker with the old one and see if i can get the same output later. Thanks for your reply Mabster
Thanks :)
Code Update:
Log in to comment