How did you get your JXPathContext object? It all depends on the context :)
Perhaps it would be a good idea to work with some collection object instead of array. -------------------- Just my two cents Regards, Tahir -----Original Message----- From: Charles Souillard [mailto:[EMAIL PROTECTED] Sent: Wednesday, March 08, 2006 11:53 AM To: Jakarta Commons Users List Subject: [JXPath] array initialisation 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.createPathAndSetValu e(JXPathContextReferenceImpl.java:469) at org.apache.commons.jxpath.ri.JXPathContextReferenceImpl.createPathAndSetValu e(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] -- No virus found in this incoming message. Checked by AVG Free Edition. Version: 7.1.375 / Virus Database: 268.2.0/276 - Release Date: 3/7/2006 -- No virus found in this outgoing message. Checked by AVG Free Edition. Version: 7.1.375 / Virus Database: 268.2.0/276 - Release Date: 3/7/2006 --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
