File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes XML and Related Technologies and the fly likes which parser to use Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "which parser to use" Watch "which parser to use" New topic

which parser to use

John Gregory
Ranch Hand

Joined: Oct 05, 2006
Posts: 118
Have a question as I'm new to xml parsing.
Say my data looks like:
<name>Mike Green</name>
<name>Dave Brown</name>

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.


Prabhu Venkatachalam
Ranch Hand

Joined: Nov 16, 2005
Posts: 502


XPATH - XPath is language used to navigate through elements and attributes in an XML document.

Best start up Reference for XPATH

Try dom4j library.

Prabhu Venkatachalam<br />SCJP 1.4,SCWCD 1.4<br />
I agree. Here's the link:
subject: which parser to use