commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Francois Swiegers <FSwieg...@RUBICO.COM>
Subject RE: [JXPath] Accessing and setting multidimensional arrays
Date Thu, 09 Jan 2003 16:28:22 GMT
I used the nightly build from the 5th (commons-jxpath-20030105.zip)

Thanks for the help.

-----Original Message-----
From: Dmitri Plotnikov [mailto:dplotnik@yahoo.com]
Sent: Thursday, January 09, 2003 6:18 PM
To: Jakarta Commons Users List
Subject: Re: [JXPath] Accessing and setting multidimensional arrays


This is supposed to work.  I have a JUnit test,
MixedModelTest.testListList(), that has almost exactly your case.  I
should really add a test that covers multidimensional arrays
explicitly.  Will do. 

Are you using the nightly build? Tell me exactly what build you are
using.

- Dmitri

--- Francois Swiegers <FSwiegers@RUBICO.COM> wrote:
> How do you access and modify properties that are multidimensional
> arrays
> using JXPath?
> 
> Here is my bean:
> 
> public Person {
> public int[][] getMatrix();
> public void setMatrix(int[][] matrix);
> }
> 
> To access the value of an element [x,y] in the array, I use:
> 
> ctx.getValue("person/matrix[x]/.[y]");
> 
> This works fine, but is there a better way of doing it?
> 
> How can I set the value of element in the Bean?
> 
> ctx.setValue("person/matrix[x]/.[y]", "10");
> 
> causes:
> 
>      [java] org.apache.commons.jxpath.JXPathException: Exception
> trying to
> set value with xpath person/matrix[4]/.[1]; Cannot setValue of an
> object
> that is not some other object's property
>      [java] 	at
>
org.apache.commons.jxpath.ri.JXPathContextReferenceImpl.setValue(JXPathConte
> xtReferenceImpl.java:318)
>      [java] 	at
>
org.apache.commons.jxpath.ri.JXPathContextReferenceImpl.setValue(JXPathConte
> xtReferenceImpl.java:309)
> 
> Any help/suggestions would be greatly appreciated.
> 
> Francois Swiegers
> CONFIDENTIALITY NOTICE
> This e-mail message (and attachments) contains confidential
> information
> intended only for the person/s to whom it is addressed. It is subject
> to
> legal privilege and any copying or unauthorised disclosure of the
> contents
> other than to the addressee is prohibited. If you have received this
> e-mail
> in error please notify us by telephone and erase all copies of the
> message
> and attachments. Thank you for your assistance.
> 
> 
> --
> To unsubscribe, e-mail:  
> <mailto:commons-user-unsubscribe@jakarta.apache.org>
> For additional commands, e-mail:
> <mailto:commons-user-help@jakarta.apache.org>
> 


__________________________________________________
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com

--
To unsubscribe, e-mail:
<mailto:commons-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail:
<mailto:commons-user-help@jakarta.apache.org>
CONFIDENTIALITY NOTICE
This e-mail message (and attachments) contains confidential information
intended only for the person/s to whom it is addressed. It is subject to
legal privilege and any copying or unauthorised disclosure of the contents
other than to the addressee is prohibited. If you have received this e-mail
in error please notify us by telephone and erase all copies of the message
and attachments. Thank you for your assistance.


Mime
View raw message