commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Francois Swiegers <FSwieg...@RUBICO.COM>
Subject [JXPath] Creating arrays using the position() function
Date Wed, 22 Jan 2003 11:10:53 GMT

I'm having problems creating array instances and enlarging arrays when the
expression containes the position() function.

I'm using the latest nightly build (2003-01-22).


interface Person {
	public String[] getAddresses();
	public void setAddresses(String[] addresses);

I also have an object factory that will create a new array of correct size
and fill it in with empty values if the addresses property is null.

a) ctx.createPath("person/addresses[2]" works fine, but
b) ctx.createPath("person/addresses[position()=2]" does not.

I THINK the reason is that the position() function is evaluated before the
ObjectFactory is given the chance to create the array. In a) above my
ObjectFactory gets called, but in b) the exception is thrown before my
ObjectFactory gets a chance to do its magic.

The exception I get is: 

org.apache.commons.jxpath.JXPathException: Expression is not a
        at SimpleArrayTest.testJXPath(

I include a simple test case that should show the problem.

I would appreciate any help, thanks.

Francois Swiegers
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.


View raw message