commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "CANDAT Jerome" <>
Subject [JXPATH] JXPath and DOM
Date Wed, 22 Oct 2003 15:35:19 GMT
Hello everyone,

First I'd like to say that JXPath is great but it lacks of some
documentation !!!

I would like to simplify the reading and modification of a DOM object using
JXPath. However, I don't know how to do it.

I made the following :

            DocumentBuilderFactory factory =

            DocumentBuilder builder = factory.newDocumentBuilder();
            Document doc = builder.parse(configurationFile);

            NodePointer pointer;

            JXPathContext context = JXPathContext.newContext(doc);

            Iterator projectList = context.iteratePointers("//project");

            while ((pointer = (NodePointer)!=null){

                System.out.println("found : " +pointer.getName());

I have two project tags in my XML but the projectsList seems to be empty....

I was wondering if I followed the good way to use JXPath?

Can someone explain how to use JXPath with DOM (for reading and modification
of elements) ?

Thanks in advance,

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message