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

Reply via email to