commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "CANDAT Jerome" <jerome.can...@c-s.fr>
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 =
DocumentBuilderFactory.newInstance();
            factory.setValidating(false);

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

            NodePointer pointer;

            JXPathContext context = JXPathContext.newContext(doc);

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

            while ((pointer = (NodePointer)projectList.next())!=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,
Jérôme.


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Mime
View raw message