Friday, November 16, 2007

parse xml with JDOM and Xpath

every now and again its good to have your config in an xml file, but i am usually to lazy to remember to how to do it properly and just use java.util.Properties. Well no more of that!

This is a short self contained code sample on how to parse some xml using jdom and jaxen

you will need:
jdom lib
jaxen lib (which may be old now)

3 comments:

  1. Have you looked at vtd-xml? it is a lot faster and memory efficient than DOM4J and JDOM

    http://vtd-xml.sf.net

    ReplyDelete
  2. List list = xpath.selectNodes(document);

    document is not defined anywhere.

    ReplyDelete
  3. thanks, surely i meant 'doc' - fixed

    ReplyDelete