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: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
