Have a question as I'm new to xml parsing. Say my data looks like: <contact-list> <contact> <name>Mike Green</name> <home-phone>555-1234</home-phone> <cell>240-1234</cell> <email>email@example.com</email> </contact> <name>Dave Brown</name> <home-phone>555-2224</home-phone> <cell>240-2234</cell> <email>firstname.lastname@example.org</email> <contact> </contact> </contact-list>
Ok, using a sax parser, I could print out all the elements. But, what if I had a situation where I had a String "Mike Green" and based on that, I wanted to grab his phone number. Aside form the name, any of the fields may be blank.
I'm not sure which parser to use. I've looked at the tutorial and I could print out each field, but not sure how to grab info based on what I want to do. The DOM tutorial shows is how to print a tree structure and I think this is what I want, just not sure how to proceed.