What is the best (and easiest) XML parser to use for a Java class that will be deployed using jdk1.5.0_12.

What is the best (and easiest) XML parser to use for a Java class that will be deployed using jdk1.5.0_12.  It will be deployed under a JBoss environment but should preferably not be server specific.
lasuttonAsked:
Who is Participating?
 
msmolyakCommented:
XPath is indeed the way to access directly the elements and nodes of the parsed XML document. JDom supports XPath traversal and searches:

http://www.onjava.com/pub/a/onjava/2005/01/12/xpath.html

http://javaboutique.internet.com/tutorials/jdom&/

Michael
0
 
CEHJCommented:
(both exist in Java 5)
0
Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
lasuttonAuthor Commented:
Can you point me to any sample classes that use either of these parsers?  i.e.: a class that reads one or two elements from an XML document (or String included in the class that is moved into the XML document).
0
 
msmolyakCommented:
Are you looking for an actual parser or for an easy-to-use API to parse an XML document? If you are looking for the latter, I would suggest using JDOM, an alternative to DOM API you would have to use if you were to go with JDK XML parsing API.

http://www.jdom.org/

JDOM's mission is to make API for parsing, traversing and building XML documents simpler that that afforded by W3C DOM API.

Some JDOM usage examples:

http://www.cafeconleche.org/books/xmljava/examples/14/index.html


Michael
0
 
lasuttonAuthor Commented:
What I am looking for at this point is an easy way to traverse and search for specific elements and attributes in an XML document that is less than 16k in size.  Basically I need to be able to read the document as if I would try to look for records in a database with an index with multiple keys.
0
 
lasuttonAuthor Commented:
...something along the lines of xPath type search capabilities but that can be built within the Java class.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.