commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Tahir Akhtar" <ta...@spectrum-tech.com>
Subject RE: [JXPath] array initialisation
Date Wed, 08 Mar 2006 06:59:26 GMT
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:Charles.Souillard@ext.bull.net] 
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: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org

-- 
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: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Mime
View raw message