commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Scott Heaberlin" <heabd...@gmail.com>
Subject Re: JXPath 1.2 - get objects by class
Date Tue, 17 Jul 2007 01:44:24 GMT
.new() will instantiate one instance.  Try using getClass() as a
pseudo property (the introspector treats this as a read-only property.
 Something along these lines:

Iterator iterator =
context.iterate("//@class=java.lang.Class.forName('com.mycompany.MyObject')");

You may even be able to get away with
"//@class/name='com.mycompany.MyObject'".

Hope this helps,

-Scott Heaberlin


On 7/16/07, P.Chauhan@pilz.ie <P.Chauhan@pilz.ie> wrote:
> Hi,
>
> Just wondering if it is possible to retrieve all objects of a specific
> class from an object tree including if they are contained somewhere in the
> list.
>
> Will this work
>
> Iterator iterator = context.iterate("//com.mycompany.MyObject.new()");
>
> Thanks.

---------------------------------------------------------------------
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