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 Re: [JXPATH] JXPath and DOM
Date Wed, 22 Oct 2003 17:01:25 GMT
It is just that I am STUPID !!!
The path to the resource file was wrong. I catch the exception raised but do
not display the error so I guessed that my code was wrong...

One mail for nothing sorry.

Thanks for your answer anyway.



----- Original Message -----
From: "__matthewHawthorne" <matth@phreaker.net>
To: "Jakarta Commons Users List" <commons-user@jakarta.apache.org>
Sent: Wednesday, October 22, 2003 6:29 PM
Subject: Re: [JXPATH] JXPath and DOM


> Here is a way that works for me:
>
>
> import org.apache.commons.jxpath.Container;
> import org.apache.commons.jxpath.xml.DocumentContainer;
>
> URL configURL = getClass().getResource("test.xml");
>
> Container container = new DocumentContainer(configURL,
> DocumentContainer.MODEL_JDOM);
>
>
> Maybe try it this way and see what happens?
>
>
>
>
> CANDAT Jerome wrote:
>
> > 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
>


---------------------------------------------------------------------
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