commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Charles Souillard <Charles.Souill...@ext.bull.net>
Subject [JXPath] array initialisation
Date Wed, 08 Mar 2006 06:53:26 GMT
Hi all,

I want to know how it is possible to init an empty array.
In my case, I am using XPath to specify a location into a xml tree to 
set a value.
Let me explain you :

I have a bookstore with a set of books.
Books are not yet initialized. I want to set the book at the index number 2.
the xpath expression is :
/bookstore/books[2]

In fact I am using the following java code :

context.createPathAndSetValue(myQuery,value);

I get the following exception :

Caused by: org.apache.commons.jxpath.JXPathException: Exception trying 
to create xpath /bookstore/book[2]; Cannot access property: books; 
java.lang.NullPointerException
        at 
org.apache.commons.jxpath.ri.JXPathContextReferenceImpl.createPathAndSetValue(JXPathContextReferenceImpl.java:469)
        at 
org.apache.commons.jxpath.ri.JXPathContextReferenceImpl.createPathAndSetValue(JXPathContextReferenceImpl.java:457)

Can you tell if there is a workaround or what I am doing wrong ?

Thanks,
Charles

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