Does commons-configuration v1.6 work with JREv1.5? [Commons]

2009-08-12 Thread Andrew Hughes
Hi, simple question I know... but, I'm lost!!!
My JavaFX project won't recognize *org.apache.commons.configuration.**.
JavaFX v1.2's SDK seems to have inherent problems with Java6, because the
SDK is released with rt15.jar (Java 1.5 runtime)!
If the answer is yes because configuration 1.6 has a compiled target=1.6 (or
uses 1.6 classes) then what are my alternatives?

Thanks for reading (and hopefully replying).


Re: Does commons-configuration v1.6 work with JREv1.5? [Commons]

2009-08-12 Thread Andrew Hughes
Gotcha!!! Thank You. JavaFX refuses to read the jar All other common's
jars work just fine :'(

On Thu, Aug 13, 2009 at 10:36 AM, James Carman
ja...@carmanconsulting.comwrote:

 It's not compiled with target=1.6.  If you look at the manifest, it
 uses the same target as commons-parent-11, 1.3:

 X-Compile-Source-JDK: 1.3
 X-Compile-Target-JDK: 1.3

 It was compiled with a 1.4 Sun JDK:

 Created-By: 1.4.2_18 (Sun Microsystems Inc.)
 Build-Jdk: 1.4.2_18

 So, it should be 1.5 compatible.  What is the exact error you're
 getting?  It sounds like you've got a classpath issue.  Are you using
 Maven?

 On Wed, Aug 12, 2009 at 8:48 PM, Andrew Hughesahhug...@gmail.com wrote:
  Hi, simple question I know... but, I'm lost!!!
  My JavaFX project won't recognize *org.apache.commons.configuration.**.
  JavaFX v1.2's SDK seems to have inherent problems with Java6, because the
  SDK is released with rt15.jar (Java 1.5 runtime)!
  If the answer is yes because configuration 1.6 has a compiled target=1.6
 (or
  uses 1.6 classes) then what are my alternatives?
 
  Thanks for reading (and hopefully replying).
 

 -
 To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
 For additional commands, e-mail: user-h...@commons.apache.org




Re: [JXPath] Iterators and Pointers (on partial matches)

2009-06-04 Thread Andrew Hughes
Hi Matt,
Your explanation re: HierarchyTable sounds very similar. Another possible
option is if I can somehow tokenize the steps in the expression itself.
Then I could keep appending the .next() token... and re-run the expression
until it fails (in actual fact it would be best to start removing '--'
tokens from the end and re-querying as it is more responsive).

Somthing that would look like...

IteratorString tokens =
MythicalTokenizer.tokenize(/Earth/Australia/NSW/Sydney/Utopia);
jxpathContext.selectNode(expression+=tokens.next()); // success with
expression = /Earth
jxpathContext.selectNode(expression+=tokens.next()); // success with
expression = /Earth/Australia
jxpathContext.selectNode(expression+=tokens.next()); // success with
expression = /Earth/Australia/NSW
jxpathContext.selectNode(expression+=tokens.next()); // success with
expression = /Earth/Australia/NSW/Sydney
jxpathContext.selectNode(expression+=tokens.next()); // FAILURE with
expression = /Earth/Australia/NSW/Sydney/Utopia


I've had a look at the compiled expressions and parser's on the RI but I
can't see anything that would allow me to do this :'(   Hopefully I am
missing something.

THANKS HEAPS FOR THE RESPONSE
--Andrew


On Fri, Jun 5, 2009 at 12:03 AM, Matt Benson gudnabr...@yahoo.com wrote:


 Hi Andrew,
  I'm not sure if JXPath is necessarily really the right tool for this.
  This almost just looks like a sort of hierarchical lookup.  I have a
 HierarchyTable we use at my $work for these type purposes; unfortunately I
 haven't yet gotten clearance to release it into the wild.  I plan someday to
 include it in [collections] but it may need rewriting before the Commons
 community would even agree to it, the reason being that it's somewhat heavy.
  I suppose I can explain its implementation:  It stores hierarchical data a
 node per level, and its nodes it uses each hold a HashMap (the heavy part)
 to keep track of child nodes.  So you _could_ implement your own version of
 that.  If you are determined to use JXPath for this, for example if you just
 really need to be able to get at this information with an expression, you
 might be able to accomplish it with a custom function but I'm still afraid
 at some point you might have to parse the steps, or rely on JXPath RI
  packages/classes.

 HTH,
 Matt

 --- On Wed, 6/3/09, Andrew Hughes ahhug...@gmail.com wrote:

  From: Andrew Hughes ahhug...@gmail.com
  Subject: [JXPath] Iterators and Pointers (on partial matches)
  To: Commons Users List user@commons.apache.org
  Date: Wednesday, June 3, 2009, 9:45 PM
  Hi Again,
  I'm trying to resolve an issue I have trying to step
  through object's
  slightly *different* to the JXPath ReferenceImpl.
 
  Say I have String expression =
  /Earth/Australia/NSW/Sydney/Utopia; Since
  Utopia is a mythical place that never exists I'll never
  get a result from
  selectNode(/Earth/Australia/NSW/Sydney/Utopia);
 
  Neither can I do this with an iterator:
 
 http://commons.apache.org/jxpath/apidocs/org/apache/commons/jxpath/JXPathContext.html#iteratePointers(java.lang.String)
 
  If the xpath matches no properties in the graph, the
  Iterator be empty, but
  not null.
 
  I've tested this is and when I look for Utopia, I get an
  empty iterator
 
  I need an iterator that allows me see just how close I can
  get to 'Utopia':
 
  Iterator step =
  jxpathContext.iterator(/Earth/Australia/NSW/Sydney/Utopia
  );
  system.out.println(step.next().toString());// '' the root
  object
  system.out.println(step.next().toString());// 'Earth'
  system.out.println(step.next().toString());// 'Australia'
  system.out.println(step.next().toString());// 'NSW'
  system.out.println(step.next().toString());// 'Sydney'
  system.out.println(step.next().toString());// THROWS AN
  EXCEPTION BECAUSE
  UTOPIA DOES NOT EXIST
 
 
  Thanks heaps for reading (again)  :)
 




 -
 To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
 For additional commands, e-mail: user-h...@commons.apache.org




[JXPath] Questions about pointers, listeners filters

2009-04-23 Thread Andrew Hughes
Hi All - probably just Matt tho   :)
I've had some great results with JXPath, and I am now getting down to the
nitty/gritty of what I am trying to achieve. Which is quite complex and I've
no doubt that more experienced people than me exist in this area! Help is
once again greatly appreciated!!!

Background: I am dealing with dynamic objects (Nodes). Node's
appear/disappear at runtime and are encapsulated in a heirarchy of HashMap's
for JXPath's context bean. This works fantastic, but I have two remaining
mandatory requirements.

Requirement 1: Listening
As a new node appears, listeners defined as expressions would like to know
about this. For example, someone would like to know if a Ferrari ever
appears in the context bean:  //c...@name=Ferrari]
or /Transport/Vehicle/c...@name=Ferrari]. I believe that I should be
testing is if the newly created/removed node/pointer is found in any of the
supplied listening expressions? Ideally this can be done by traversing the
minimal number of object's as possible - and could be too inefficient :'(
for use.

Requirement 2: Filtering.
As a new node appear's I would like to know if I should include this node in
the context bean hierarchy (i.e. addNewChild()) or ignore it. The criteria
is if the new node is found using an expression (include or exclude). For
example, if we don't deal with China then we might have an exclude
expression /World/Asia/China or /World/Asia/*. Can I determine if the new
node is within an includes/excludes expression without having to add the
node to the context, then testing, then removing - becuase this has the
potential to falsly invoke listeners in Requirement #1

I'd like to know if there is any helpful functionality within jxpath that I
am unaware of. I suspect there is


As usual... I'm incredibly thankful for any help I can get :)


Re: [JXPath] Custom Functions the Current Pointer

2009-04-21 Thread Andrew Hughes
Hi Matt,
WooHoo, I got it working :) Kudos for JXPath :D (Again)

Constructive suggestion: the JXPath doco talks a lot about the use of
functions within predicates, and the programmatic use or $variables within
custom functions. I was unable to find an example where a function used an
expression-pointer-value as a parameter. This would be the most likely use
JXPath functions in my opinion

Example (for anyone who's reading this in some future context):


The expression, '/World/Country/Australia'   returns an value/instance of
Australia.java. If you would like to get the current exchange rate for
Australia then you would most likely want do this with the following xpath
expression:

mynamespace:MyFunctions.getExchangeRate(/World/Country/Australia)


A corresponding Java function is implemented to provide such
function(ality):

package com.blah.whatever.project;
public class MyFunctions {
public static double getExchangeRate(Australia australia) {
//pojo code goes in here...
}
}


And to complete this, the Java function needs to be set in the
JXPathContext... (don't forget the package string terminating .):

JXPathContext.setFunctions(new
PackageFunctions(com.blah.whatever.project., mynamespace));


That's it.







On Tue, Apr 21, 2009 at 11:39 PM, Matt Benson gudnabr...@yahoo.com wrote:


 Hi, Andrew.  Your example looks pretty good... what happens exactly when
 you try it?

 -Matt

 --- On Mon, 4/20/09, Andrew Hughes ahhug...@gmail.com wrote:

  From: Andrew Hughes ahhug...@gmail.com
  Subject: [JXPath] Custom Functions  the Current Pointer
  To: Commons Users List user@commons.apache.org
  Date: Monday, April 20, 2009, 11:31 PM
  Hi there, I think this is a really
  easy question... sorry for this...
  I have created my own function as below
 
  package com.blah.function;
 
  public class Calculate {
  public static Calculation
  doCalculation(ExpressionContext context, int
  x) {
  //stuff goes in here...
  }
 
  }
 
 
  I've  also registered it with the JXPathContext as
  below...
 
  jxPathContext.setFunctions(new
  PackageFunctions(com.blah.function.,
  jxpath));
 
 
  I see how this works programatically, but not in an
  expression. For example,
  if I want to find a node and then use that node in
  doCalculation... how?
 
  '/Something/I/CanFind' then I want to run
  'doCalculation(6)' on the result
  of the previous query's result.
 
 
  I would have thought this would be something like the
  following but I am
  obviously wrong...
 
  jxpath:Calculate.doCalculation(/Something/I/CanFind,6);
 
  /Something/I/CanFind[jxpath:Calculate.doCalculation(6)];
 
 
  Once an ExpressionContext is involved it no longer
  works.
 
 
  Any help would be much appreciated :)
 




 -
 To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
 For additional commands, e-mail: user-h...@commons.apache.org




Re: [JXPath] Whitespace in Expression/Property

2009-03-23 Thread Andrew Hughes
Doesn't work, but I'll need to develop some testing code in order to
publically re-produce how this occurs.
p.s. both name and @name don't work.


p.p.s THANKS HEAPS MATT!!!


On Wed, Mar 18, 2009 at 2:42 AM, Matt Benson gudnabr...@yahoo.com wrote:


 Maybe /Earth/Australia/@name='New South Wales']/Sydney?  :|

 -Matt

 --- On Mon, 3/16/09, Andrew Hughes ahhug...@gmail.com wrote:

  From: Andrew Hughes ahhug...@gmail.com
  Subject: [JXPath] Whitespace in Expression/Property
  To: Commons Users List user@commons.apache.org
  Date: Monday, March 16, 2009, 11:42 PM
  Hi Again,
  How can I access a property named 'New South Wales' if it
  has whitespace in
  it? Example Expression: '/Earth/Australia/New South
  Wales/Sydney'
 
  THANKS SO MUCH
 




 -
 To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
 For additional commands, e-mail: user-h...@commons.apache.org




[JXPath] Whitespace in Expression/Property

2009-03-16 Thread Andrew Hughes
Hi Again,
How can I access a property named 'New South Wales' if it has whitespace in
it? Example Expression: '/Earth/Australia/New South Wales/Sydney'

THANKS SO MUCH


Re: JXPath over Generic Collection?, How?

2009-03-11 Thread Andrew Hughes
A whirl and a win!
I'm very close to a complete solution here (with loads of assistance from
Matt, THANK YOU) based on Dyna Beans however there is one remaining problem
(since we have duplicate elements).

According to:  http://www.w3.org/TR/xpath#path-abbrev
http://www.w3.org/TR/xpath#path-abbrev

* selects all element children of the context node


Expression: '/root/animal/dog/*' should return all dog's, instead it returns
the first() dog (BOXER) only. I am unsure if this in an unrealistic
requirement of JXPath and also where should I look to possibly 'fix' this if
it indeed would compliment the current features?


Thanks HEAPS!




On Thu, Mar 5, 2009 at 3:05 AM, Matt Benson gudnabr...@yahoo.com wrote:


 Apparently the reason I was so ready to agree this was a bug that should be
 fixed is that I already fixed it as
 http://issues.apache.org/jira/browse/JXPATH-128 .  So since you're already
 experienced with building JXPath now you should be able to build from svn
 trunk and give that a whirl.

 -Matt

 --- On Wed, 3/4/09, Matt Benson gudnabr...@yahoo.com wrote:

  From: Matt Benson gudnabr...@yahoo.com
  Subject: Re: JXPath over Generic Collection?, How?
  To: Commons Users List user@commons.apache.org
  Date: Wednesday, March 4, 2009, 7:57 AM
 
  Hi Andrew,
I agree that going through the list of properties
  should avoid the explicit class check problem (I think
  this is because you are using LazyDynaBeans instead of
  regular DynaBeans).  As for returning all matches vs.
  the first match, rather than selectValue(...) you need to
  selectNodes(...), or iterate(...).  There are other
  useful methods, e.g. those dealing with pointers, also
  available on JXPathContext.
 
  So as for your bug, yes it can/should be fixed, but you
  might also consider whether you can use non-lazy DynaBeans
  instead.
 
  Regards,
  Matt
 
  --- On Tue, 3/3/09, Andrew Hughes ahhug...@gmail.com
  wrote:
 
   From: Andrew Hughes ahhug...@gmail.com
   Subject: Re: JXPath over Generic Collection?,
  How?
   To: Commons Users List user@commons.apache.org
   Date: Tuesday, March 3, 2009, 5:37 PM
   For efficiency reasons I can see why
   you are using String[] here and not
   List.add()...
   Anyway, I have a fix (sort of) for this bug. The
  number of
   names needs to be
   calculated a little differently to what it currently
  is...
  
   public String[] getPropertyNames() {
   /* @todo do something about the
   sorting - LIKE WHAT? - MJB */
   if (names == null) {
   DynaClass
   dynaClass = dynaBean.getDynaClass();
   DynaProperty[]
   properties = dynaClass.getDynaProperties();
   int count =
   properties.length;
   boolean hasClass
   = dynaClass.getDynaProperty(class) != null;
  
   //count the
   number of property names we have
   count = 0;
   for (int i = 0; i
properties.length; i++) {
  
   String name = properties[i].getName();
   if
   (!hasClass || !name.equals(class)) {
  
   count++; //it's only a property is it's not a
   class and
   doesn't just have a class property.
   }
   }
   //read the
   property names into a String[] to return
   names = new
   String[count];
   for (int i = 0, j
   = 0; i  properties.length; i++) {
  
   String name = properties[i].getName();
   if
   (!hasClass || !name.equals(class)) {
  
   names[j++] = name;
   }
   }
  
   Arrays.sort(names);
   }
   return names;
   }
  
   Now I can sort of sucessfully run all my expressions,
   yippee!! However, I
   now have a problem with multiple deep results. Queries
  like
   //dog/* I would
   expect to return all dog's[] but this just returns
  the
   first one it finds.
   Maybe this is asking a little too much of JXPath and
   child/node
   step-up/step-down traversal? Matt can probably tell me
  if
   this is or is not
   the case plase :)
  
  
  
  
  
   On Wed, Mar 4, 2009 at 9:38 AM, Andrew Hughes ahhug...@gmail.com
   wrote:
  
Pretty sure this is a bug in JXPath - and it is
  not
   tested by the current
unit tests.
I can't quite work out 100% of what's going on
  here...
   but it has to do
with gathering the property names from a
  DynaBean
   child member of a (parent)
DynaBean. Especially, when it try's to deal with
  the
   property named 'name'
and 'class'.
   
The problem with query '//dog' etc's
   'ArrayOutOfBoundsException 0' occurs
below. And rightfully so, names[] is a zero
  length
   array and for some
reason JXPath is trying to set a value for the
  first
   entry of a zero length
array.  That aint ever going to work! But why
  is
   the array length zero?
Because the properties.length==1, however the
   'hasClass==true' and it's
count-- then negates the correct count calculated
  from

commons-config : property key's with whitespace

2009-03-09 Thread Andrew Hughes
Howdy,
We've got legacy/shared property files for our config (i.e. can't change the
property files to solve this). We're trying to use commons-config but it has
difficulty dealing with our properties files as the key's contain
whitespace.

Any help on how I can resolve this would be most welcomed :)

Example Property:

Welcome Message=Hello World


Cheers.


Re: JXPath over Generic Collection?, How?

2009-03-03 Thread Andrew Hughes
For efficiency reasons I can see why you are using String[] here and not
List.add()...
Anyway, I have a fix (sort of) for this bug. The number of names needs to be
calculated a little differently to what it currently is...

public String[] getPropertyNames() {
/* @todo do something about the sorting - LIKE WHAT? - MJB */
if (names == null) {
DynaClass dynaClass = dynaBean.getDynaClass();
DynaProperty[] properties = dynaClass.getDynaProperties();
int count = properties.length;
boolean hasClass = dynaClass.getDynaProperty(class) != null;

//count the number of property names we have
count = 0;
for (int i = 0; i  properties.length; i++) {
String name = properties[i].getName();
if (!hasClass || !name.equals(class)) {
count++; //it's only a property is it's not a class and
doesn't just have a class property.
}
}
//read the property names into a String[] to return
names = new String[count];
for (int i = 0, j = 0; i  properties.length; i++) {
String name = properties[i].getName();
if (!hasClass || !name.equals(class)) {
names[j++] = name;
}
}
Arrays.sort(names);
}
return names;
}

Now I can sort of sucessfully run all my expressions, yippee!! However, I
now have a problem with multiple deep results. Queries like //dog/* I would
expect to return all dog's[] but this just returns the first one it finds.
Maybe this is asking a little too much of JXPath and child/node
step-up/step-down traversal? Matt can probably tell me if this is or is not
the case plase :)





On Wed, Mar 4, 2009 at 9:38 AM, Andrew Hughes ahhug...@gmail.com wrote:

 Pretty sure this is a bug in JXPath - and it is not tested by the current
 unit tests.
 I can't quite work out 100% of what's going on here... but it has to do
 with gathering the property names from a DynaBean child member of a (parent)
 DynaBean. Especially, when it try's to deal with the property named 'name'
 and 'class'.

 The problem with query '//dog' etc's 'ArrayOutOfBoundsException 0' occurs
 below. And rightfully so, names[] is a zero length array and for some
 reason JXPath is trying to set a value for the first entry of a zero length
 array.  That aint ever going to work! But why is the array length zero?
 Because the properties.length==1, however the 'hasClass==true' and it's
 count-- then negates the correct count calculated from properties.length. I
 think the problem is in the hasClass calculation... 'boolean hasClass =
 dynaClass.getDynaProperty(class) != null;'  or the conditional 'if'
 statement. I don't understand the JXPath logic here completely, but I know
 it doesn't deal with the way I am using it and I genuinely feel this is a
 bug we can fix :'(


 public String[] getPropertyNames() {
 /* @todo do something about the sorting - LIKE WHAT? - MJB */
 if (names == null) {
 DynaClass dynaClass = dynaBean.getDynaClass();
 DynaProperty[] properties = dynaClass.getDynaProperties();
  //returns one property 'name=root' (correct)
 int count = properties.length; //returns/set's '1' (correct)
 boolean hasClass = dynaClass.getDynaProperty(class) != null;
 //returns/sets 'true' (?unknown?)
 if (hasClass) { //this is true and executes
 count--;   // Exclude class from properties
 }
 names = new String[count]; //names is a zero length array.
 WRONG!!! I do have at least 1 property called 'name'
 for (int i = 0, j = 0; i  properties.length; i++) {
 String name = properties[i].getName();
 if (!hasClass || !name.equals(class)) {
 names[j++] = name; //it breaks here
 ArrayOutOfBoundsException 0! WRONG :'(
 }
 }
 Arrays.sort(names);
 }
 return names;
 }




 On Fri, Feb 27, 2009 at 10:02 AM, Andrew Hughes ahhug...@gmail.comwrote:

 Thanks again Matt, good to hear that it's working at your end :) At my end
 JXPath's DynaBeanPropertyPointer seems to get into problems
 with ArraIndexOutOfBounds exceptions on the PropertyNames of my DynaBean (see
 the strack trace below) with many of the queries. I can only speculate
 why this might be... and I won't speculate publically. I'm running the code
 with JXPath 1.3,  BeanUtils 1.8.0, and Java 1.6_u11 (within eclipse 3.4). The
 code I'm trying to run is pasted below VERBATIM if that works on your
 environment and not mine then it must be a compatibility/platform problem.
 You've helped me out heaps so far Matt but can I please ask you to
 copy/paste the VERBATIM code and test?

 2009-02-27 08:43:59,940 ERROR (Main.java:89) [runEvaluation] Failed

Re: JXPath over Generic Collection?, How?

2009-02-23 Thread Andrew Hughes
OK, email #19 to the list. I'm both incredibly patient and skeptical that
this will ever work. I might try and run this in a debugger and track down
how JXPath traverses the DynaBean but given the reflection involved
that might be a painful task.
--AH


On Tue, Feb 17, 2009 at 1:11 PM, Andrew Hughes ahhug...@gmail.com wrote:

 Ping... if anyone can help with this JXPath  DynaBeans problem I'd be
 REALLY THANKFUL :)


 On Fri, Feb 13, 2009 at 1:55 PM, Andrew Hughes ahhug...@gmail.com wrote:

 Howdy,
 I've taken Matt's suggestion onboard and I have investigated DynaBeans.
 These look pretty good for all intestive purposes and there's a code
 examples below how to build the data structure:

 + root [...@name=ROOT]
 + animal [...@name=ANIMAL]
 + dog [...@name=DOG]
 + boxer [...@name=BOXER]
 + labrador [...@name=LABRADOR]
 + cat [...@name=CAT]
 + tiger [...@name=TIGER-ONE]
 + tiger [...@name=TIGER-TWO]
 + tiger [...@name=TIGER-THREE]
 + lion [...@name=LION]


 And the code looks like...

  LazyDynaBean lazyDynaBean = new LazyDynaBean(); //the transparent root.
  LazyDynaBean root = new LazyDynaBean();
 LazyDynaBean animal = new LazyDynaBean();
  LazyDynaBean dog = new LazyDynaBean();
 LazyDynaBean cat = new LazyDynaBean();
  LazyDynaBean boxer = new LazyDynaBean();
 LazyDynaBean labrador = new LazyDynaBean();
  LazyDynaBean tiger1 = new LazyDynaBean();
 LazyDynaBean tiger2 = new LazyDynaBean();
  LazyDynaBean tiger3 = new LazyDynaBean();
 LazyDynaBean lion = new LazyDynaBean();
  //set the @name property of each bean, user UPPER to make them distinct
 for examples.
 root.set(name,ROOT);
  animal.set(name,ANIMAL);
 dog.set(name,DOG);
  cat.set(name,CAT);
 boxer.set(name,BOXER);
  labrador.set(name,LABRADOR);
 tiger1.set(name,TIGER-ONE);
  tiger2.set(name,TIGER-TWO);
 tiger3.set(name,TIGER-THREE);
  lion.set(name,LION);
 //build the bean hierarchy.
  lazyDynaBean.set(root,0, root);
 root.set(animal,0, animal);
  animal.set(dog,0,dog);
 animal.set(cat,0,cat);
 dog.set(labrador,0,labrador);
  dog.set(boxer,0, boxer);
 cat.set(tiger,0,tiger1);//duplicate
  cat.set(tiger,1,tiger2);//duplicate
 cat.set(tiger,1,tiger3);//duplicate
  cat.set(lion,0,lion);
 JXPathContext context = JXPathContext.newContext(lazyDynaBean);
 String query = /root/animal/cat/tiger;
 Object value = context.getValue(query);


 But there's a problem with JXPath querying this also. Absolute Paths like
  '/root/animal/cat/tiger' or '/root/animal/cat/tiger'[2]' work perfectly.
 But I don't have anyluck doing deep searches. For examples the following
 just won't work.
 '//cat'
 //*...@name='LION']
 /root/animal/cat/tig...@name='TIGER-TWO']

 Things are looking up, but is this behavior to be expected?

  Cheers,
 --AH


 On Thu, Feb 12, 2009 at 6:43 AM, Matt Benson gudnabr...@yahoo.comwrote:





 --- On Wed, 2/11/09, Andrew Hughes ahhug...@gmail.com wrote:

  From: Andrew Hughes ahhug...@gmail.com
  Subject: Re: JXPath over Generic Collection?, How?
  To: Commons Users List user@commons.apache.org
  Date: Wednesday, February 11, 2009, 4:19 AM
  Still No Luck, I have removed recursive generic collections
  and have tried
  the following code... this is becoming a marathon effort
  :'(
 
  public class Thing {
 
  public Thing(String name) {
  this.name = name;
  }
  private String name = ;
 
  public String getName() {
  return name;
  }
  private ArrayListThing children = new
  ArrayListThing();
 
  public ArrayListThing getChildren() {
  return children;
  }
 
  }
 
 
  public static void main(String[] args) {
  //get some same data
  Thing animal = new Thing(Animal);
  //Animal.Dog.*
  Thing dog = new Thing(Dog);
  dog.getChildren().add(new
  Thing(Labrador));
  dog.getChildren().add(new
  Thing(Boxer));
  animal.getChildren().add(dog);
  //Animal.Cat.*
  Thing cat = new Thing(Cat);
  cat.getChildren().add(new Thing(Lion));
  cat.getChildren().add(new
  Thing(Tiger));
  animal.getChildren().add(cat);
 
  //run a query on it
  JXPathContext context =
  JXPathContext.newContext(animal);
  String query = /Animal;
  Thing result = (Thing) context.getValue(query);
  String path = context.getPointer(query).asPath();
  System.out.println(Ran ' + query +
  ' and got ' +
  result.getName() + ' on path ' + path +
  '.);
  }
 

 What would you be trying to select?  If you want to know how to look for
 a given Thing in this graph, I can probably help.  If you want to know what
 graph will allow you to use a preconceived notion of the xpath you want to
 use, that will be harder.  You might use [beanutils] dynabeans in
 conjunction with [jxpath] to try and achieve the latter.

 -Matt

 
 
 
  On Wed, Feb 11, 2009 at 3:08 PM, Andrew Hughes

Re: JXPath over Generic Collection?, How?

2009-02-16 Thread Andrew Hughes
Ping... if anyone can help with this JXPath  DynaBeans problem I'd be
REALLY THANKFUL :)

On Fri, Feb 13, 2009 at 1:55 PM, Andrew Hughes ahhug...@gmail.com wrote:

 Howdy,
 I've taken Matt's suggestion onboard and I have investigated DynaBeans.
 These look pretty good for all intestive purposes and there's a code
 examples below how to build the data structure:

 + root [...@name=ROOT]
 + animal [...@name=ANIMAL]
 + dog [...@name=DOG]
 + boxer [...@name=BOXER]
 + labrador [...@name=LABRADOR]
 + cat [...@name=CAT]
 + tiger [...@name=TIGER-ONE]
 + tiger [...@name=TIGER-TWO]
 + tiger [...@name=TIGER-THREE]
 + lion [...@name=LION]


 And the code looks like...

  LazyDynaBean lazyDynaBean = new LazyDynaBean(); //the transparent root.
  LazyDynaBean root = new LazyDynaBean();
 LazyDynaBean animal = new LazyDynaBean();
  LazyDynaBean dog = new LazyDynaBean();
 LazyDynaBean cat = new LazyDynaBean();
  LazyDynaBean boxer = new LazyDynaBean();
 LazyDynaBean labrador = new LazyDynaBean();
  LazyDynaBean tiger1 = new LazyDynaBean();
 LazyDynaBean tiger2 = new LazyDynaBean();
  LazyDynaBean tiger3 = new LazyDynaBean();
 LazyDynaBean lion = new LazyDynaBean();
  //set the @name property of each bean, user UPPER to make them distinct
 for examples.
 root.set(name,ROOT);
  animal.set(name,ANIMAL);
 dog.set(name,DOG);
  cat.set(name,CAT);
 boxer.set(name,BOXER);
  labrador.set(name,LABRADOR);
 tiger1.set(name,TIGER-ONE);
  tiger2.set(name,TIGER-TWO);
 tiger3.set(name,TIGER-THREE);
  lion.set(name,LION);
 //build the bean hierarchy.
  lazyDynaBean.set(root,0, root);
 root.set(animal,0, animal);
  animal.set(dog,0,dog);
 animal.set(cat,0,cat);
 dog.set(labrador,0,labrador);
  dog.set(boxer,0, boxer);
 cat.set(tiger,0,tiger1);//duplicate
  cat.set(tiger,1,tiger2);//duplicate
 cat.set(tiger,1,tiger3);//duplicate
  cat.set(lion,0,lion);
 JXPathContext context = JXPathContext.newContext(lazyDynaBean);
 String query = /root/animal/cat/tiger;
 Object value = context.getValue(query);


 But there's a problem with JXPath querying this also. Absolute Paths like
  '/root/animal/cat/tiger' or '/root/animal/cat/tiger'[2]' work perfectly.
 But I don't have anyluck doing deep searches. For examples the following
 just won't work.
 '//cat'
 //*...@name='LION']
 /root/animal/cat/tig...@name='TIGER-TWO']

 Things are looking up, but is this behavior to be expected?

 Cheers,
 --AH


 On Thu, Feb 12, 2009 at 6:43 AM, Matt Benson gudnabr...@yahoo.com wrote:





 --- On Wed, 2/11/09, Andrew Hughes ahhug...@gmail.com wrote:

  From: Andrew Hughes ahhug...@gmail.com
  Subject: Re: JXPath over Generic Collection?, How?
  To: Commons Users List user@commons.apache.org
  Date: Wednesday, February 11, 2009, 4:19 AM
  Still No Luck, I have removed recursive generic collections
  and have tried
  the following code... this is becoming a marathon effort
  :'(
 
  public class Thing {
 
  public Thing(String name) {
  this.name = name;
  }
  private String name = ;
 
  public String getName() {
  return name;
  }
  private ArrayListThing children = new
  ArrayListThing();
 
  public ArrayListThing getChildren() {
  return children;
  }
 
  }
 
 
  public static void main(String[] args) {
  //get some same data
  Thing animal = new Thing(Animal);
  //Animal.Dog.*
  Thing dog = new Thing(Dog);
  dog.getChildren().add(new
  Thing(Labrador));
  dog.getChildren().add(new
  Thing(Boxer));
  animal.getChildren().add(dog);
  //Animal.Cat.*
  Thing cat = new Thing(Cat);
  cat.getChildren().add(new Thing(Lion));
  cat.getChildren().add(new
  Thing(Tiger));
  animal.getChildren().add(cat);
 
  //run a query on it
  JXPathContext context =
  JXPathContext.newContext(animal);
  String query = /Animal;
  Thing result = (Thing) context.getValue(query);
  String path = context.getPointer(query).asPath();
  System.out.println(Ran ' + query +
  ' and got ' +
  result.getName() + ' on path ' + path +
  '.);
  }
 

 What would you be trying to select?  If you want to know how to look for a
 given Thing in this graph, I can probably help.  If you want to know what
 graph will allow you to use a preconceived notion of the xpath you want to
 use, that will be harder.  You might use [beanutils] dynabeans in
 conjunction with [jxpath] to try and achieve the latter.

 -Matt

 
 
 
  On Wed, Feb 11, 2009 at 3:08 PM, Andrew Hughes
  ahhug...@gmail.com wrote:
 
   Yeah, that makes sense. The part that was confusing me
  is that if I
   have...
  
   public class Thing {
  
  private ListThing children;
  
   }
  
   I was assuming I would need to prefix all of my
  expressions steps with
   '/children'. From what you said earlier this
  is not the case

commons-beanutils : DynaBean's List?

2009-02-12 Thread Andrew Hughes
Howdy,
DynaBean's look brilliant, but I am overwhealmed with options - can anyone
help me out please?

I have a hierarchy of POJO Thing's which is easiest explained.

+ Thing(key=root)
+ Thing(key=world)
+ Thing(key=transport)
+ Thing(key=car)
+ Thing(key=train)
+ Thing(key=feature)
+ Thing(key=road) //note that key'd duplicates exist!
+ Thing(key=road) //note that key'd duplicates exist!
+ Thing(key=tree) //note that key'd duplicates exist!
+ Thing(key=tree) //note that key'd duplicates exist!


Many examples use Map's (but that doesn't allow duplicate key's).

For what it's worth, I would like the following pseudo to work...

get(root.world.feature);



Help would be great,  :)


p.s. the actual key's are out of my control and change dynamically at
runtime.


Re: JXPath over Generic Collection?, How?

2009-02-10 Thread Andrew Hughes
Matt, Thank You.

Is there any other data structure I can use that would work with JXPath? My
requirement is that... a Thing can have contain multiple child Thing(s)
(and the children are allowed to be non-unique).
This is equivalent to an XML element as it can contain multiple child
elements, how do these guy's handle it I wonder?

--Andrew


On Wed, Feb 11, 2009 at 9:09 AM, Matt Benson gudnabr...@yahoo.com wrote:


 I admit I hadn't looked at this with a highly critical eye, but this
 business of Thing extending ArrayListThing seems quite strange to me.
  JXPath basically functions by opening up collections automatically, so
 the very fact that Thing is itself a Collection implies that a Thing will be
 opened up, and its children will be searched... but in this example, either
 there are no children, at the leaves, or the children themselves are
 (possibly empty) collections.  It looks as though you're trying to represent
 a tree structure.  This may be a good example of a reason for the idea of
 composition over inheritance.  I don't think you're going to get any
 traction using JXPath with this object model.

 Sorry for the bad news,
 Matt


 --- On Tue, 2/10/09, Andrew Hughes ahhug...@gmail.com wrote:

  From: Andrew Hughes ahhug...@gmail.com
  Subject: Re: JXPath over Generic Collection?, How?
  To: Commons Users List user@commons.apache.org
  Date: Tuesday, February 10, 2009, 7:16 AM
  Still busted. Example is now simplified. As soon as a
  generic Collection
  becomes involved BOOM!
 
  The Main Method to exec:
  public class App {
  public static void main( String[] args ){
  JXPathContext context =
  JXPathContext.newContext(new ThingRoot());
 
  System.out.println(((Thing)context.getValue(/root)).getName());
  }
  }
 
  The (populated) context root I am using, where root is a
  single object
  holding a List of Thing's.
  package jxpathresearch;
 
  import java.util.ArrayList;
  import java.util.List;
 
  public class ThingRoot {
  private ListThing root new ArrayList(); //this
  will serve as the root.
  public ThingRoot() {
  Thing animal = new Thing(Animal);
  root.add(animal);//Animal
  Thing dog = new Thing(Dog);
  animal.add(dog);//Animal.Dog
  dog.add(new
  Thing(Labrador));//Animal.Dog.Labrador
  dog.add(new
  Thing(Boxer));//Animal.Dog.Boxer
  }
  public ListThing getRoot() { return root; }
  }
 
  Finally here's a very simple 'Thing' that
  contains a List of Thing(s):
  public class Thing extends ArrayListThing {
  public Thing(String name){this.name = name;}
  private String name = ;
  public String getName() {return name;}
  }
 
  I can't query anything beyond /root, it doesn't
  seem to ever get traversed.
  I would expect results for //Thing and
  //thi...@name='Labrador'] etc but I
  get no results only exceptions.
 
 
  My brain is hurting.
 
 
 
  On Tue, Feb 10, 2009 at 12:22 AM, Andrew Hughes
  ahhug...@gmail.com wrote:
 
   I've noew tested a whole heap of expressions even
  //name='Tiger' nothing
   works.
  
   On Tue, Feb 10, 2009 at 12:01 AM, Andrew Hughes
  ahhug...@gmail.comwrote:
  
   I got cracking on testing this out... no luck
  (yet). Here's my testing
   code if some kind person could please take a
  look
   First my generic collection hierarchy (which only
  contains a name and
   children)...
  
   package jxpathresearch;
  
   import java.util.ArrayList;
  
   public class HierarchyPojo extends
  ArrayListHierarchyPojo {
  
   public HierarchyPojo(String name){
   this.setName(name);
   }
   private String name = ;
  
   public String getName() {
   return name;
   }
   public void setName(String name) {
   this.name = name;
   }
  
   }
  
  
   Next, the wrapper for the root context (as Matt
  suggested) and populated
   with animals...
  
   package jxpathresearch;
  
  
   public class CollectionRoot {
  
  
   private HierarchyPojo hierarchyPojo;
  
  
   public CollectionRoot(){
  
   //Animal
  
   hierarchyPojo = new
  HierarchyPojo(Animal);
  
   //Animal.Dog
  
   HierarchyPojo dog = new
  HierarchyPojo(Dog);
  
   //Animal.Dog.Labrador
  
   dog.add(new
  HierarchyPojo(Labrador));
  
   //Animal.Dog.Boxer
  
   dog.add(new
  HierarchyPojo(Boxer));
  
   //Animal.Dog.Mastiff
  
   dog.add(new
  HierarchyPojo(Mastiff));
  
   //Animal.Cat
  
   HierarchyPojo cat = new
  HierarchyPojo(Cat);
  
   //Animal.Cat.Tiger
  
   cat.add(new
  HierarchyPojo(Tiger));
  
   //Animal.Cat.Cougar
  
   cat.add(new
  HierarchyPojo(Cougar));
  
   //Animal.Cat.Leopard
  
   cat.add(new
  HierarchyPojo(Leopard));
  
   //Add Animal.Dog  Animal.Cat
  
   hierarchyPojo.add(dog);
  
   hierarchyPojo.add(cat);
  
   }
  
  
   public

Re: JXPath over Generic Collection?, How?

2009-02-10 Thread Andrew Hughes
Yeah, that makes sense. The part that was confusing me is that if I have...

public class Thing {

   private ListThing children;

}

I was assuming I would need to prefix all of my expressions steps with
'/children'. From what you said earlier this is not the case as collections
are auto traversed/loaded.

Thanks again matt! I won't get to test this out til later tonight be look
foward to seeing it working!!!

Andrew


On Wed, Feb 11, 2009 at 2:57 PM, Matt Benson gudnabr...@yahoo.com wrote:


 It should be as simple as Thing _containing_ a ListThing rather than
 _being_ a ListThing.  Composition over inheritance, do you see?

 HTH,
 Matt


 --- On Tue, 2/10/09, Andrew Hughes ahhug...@gmail.com wrote:

  From: Andrew Hughes ahhug...@gmail.com
  Subject: Re: JXPath over Generic Collection?, How?
  To: Commons Users List user@commons.apache.org, gudnabr...@yahoo.com
  Date: Tuesday, February 10, 2009, 7:06 PM
  Matt, Thank You.
 
  Is there any other data structure I can use that would work
  with JXPath? My
  requirement is that... a Thing can have contain
  multiple child Thing(s)
  (and the children are allowed to be non-unique).
  This is equivalent to an XML element as it can contain
  multiple child
  elements, how do these guy's handle it I wonder?
 
  --Andrew
 
 
  On Wed, Feb 11, 2009 at 9:09 AM, Matt Benson
  gudnabr...@yahoo.com wrote:
 
  
   I admit I hadn't looked at this with a highly
  critical eye, but this
   business of Thing extending ArrayListThing
  seems quite strange to me.
JXPath basically functions by opening up
  collections automatically, so
   the very fact that Thing is itself a Collection
  implies that a Thing will be
   opened up, and its children will be searched... but in
  this example, either
   there are no children, at the leaves, or the children
  themselves are
   (possibly empty) collections.  It looks as though
  you're trying to represent
   a tree structure.  This may be a good example of a
  reason for the idea of
   composition over inheritance.  I don't think
  you're going to get any
   traction using JXPath with this object model.
  
   Sorry for the bad news,
   Matt
  
  
   --- On Tue, 2/10/09, Andrew Hughes
  ahhug...@gmail.com wrote:
  
From: Andrew Hughes ahhug...@gmail.com
Subject: Re: JXPath over Generic
  Collection?, How?
To: Commons Users List
  user@commons.apache.org
Date: Tuesday, February 10, 2009, 7:16 AM
Still busted. Example is now simplified. As soon
  as a
generic Collection
becomes involved BOOM!
   
The Main Method to exec:
public class App {
public static void main( String[] args ){
JXPathContext context =
JXPathContext.newContext(new ThingRoot());
   
   
  System.out.println(((Thing)context.getValue(/root)).getName());
}
}
   
The (populated) context root I am using, where
  root is a
single object
holding a List of Thing's.
package jxpathresearch;
   
import java.util.ArrayList;
import java.util.List;
   
public class ThingRoot {
private ListThing root new
  ArrayList(); //this
will serve as the root.
public ThingRoot() {
Thing animal = new
  Thing(Animal);
root.add(animal);//Animal
Thing dog = new Thing(Dog);
animal.add(dog);//Animal.Dog
dog.add(new
   
  Thing(Labrador));//Animal.Dog.Labrador
dog.add(new
Thing(Boxer));//Animal.Dog.Boxer
}
public ListThing getRoot() { return
  root; }
}
   
Finally here's a very simple 'Thing'
  that
contains a List of Thing(s):
public class Thing extends ArrayListThing
  {
public Thing(String name){this.name = name;}
private String name = ;
public String getName() {return name;}
}
   
I can't query anything beyond /root, it
  doesn't
seem to ever get traversed.
I would expect results for //Thing and
//thi...@name='Labrador'] etc but I
get no results only exceptions.
   
   
My brain is hurting.
   
   
   
On Tue, Feb 10, 2009 at 12:22 AM, Andrew Hughes
ahhug...@gmail.com wrote:
   
 I've noew tested a whole heap of
  expressions even
//name='Tiger' nothing
 works.

 On Tue, Feb 10, 2009 at 12:01 AM, Andrew
  Hughes
ahhug...@gmail.comwrote:

 I got cracking on testing this out... no
  luck
(yet). Here's my testing
 code if some kind person could please
  take a
look
 First my generic collection hierarchy
  (which only
contains a name and
 children)...

 package jxpathresearch;

 import java.util.ArrayList;

 public class HierarchyPojo extends
ArrayListHierarchyPojo {

 public HierarchyPojo(String name){
 this.setName(name);
 }
 private String name = ;

 public String getName() {
 return name;
 }
 public void setName(String name

Re: JXPath over Generic Collection?, How?

2009-02-09 Thread Andrew Hughes
I got cracking on testing this out... no luck (yet). Here's my testing code
if some kind person could please take a look
First my generic collection hierarchy (which only contains a name and
children)...

package jxpathresearch;

import java.util.ArrayList;

public class HierarchyPojo extends ArrayListHierarchyPojo {

public HierarchyPojo(String name){
this.setName(name);
}
private String name = ;

public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}

}


Next, the wrapper for the root context (as Matt suggested) and populated
with animals...

package jxpathresearch;


public class CollectionRoot {


private HierarchyPojo hierarchyPojo;


public CollectionRoot(){

//Animal

hierarchyPojo = new HierarchyPojo(Animal);

//Animal.Dog

HierarchyPojo dog = new HierarchyPojo(Dog);

//Animal.Dog.Labrador

dog.add(new HierarchyPojo(Labrador));

//Animal.Dog.Boxer

dog.add(new HierarchyPojo(Boxer));

//Animal.Dog.Mastiff

dog.add(new HierarchyPojo(Mastiff));

//Animal.Cat

HierarchyPojo cat = new HierarchyPojo(Cat);

//Animal.Cat.Tiger

cat.add(new HierarchyPojo(Tiger));

//Animal.Cat.Cougar

cat.add(new HierarchyPojo(Cougar));

//Animal.Cat.Leopard

cat.add(new HierarchyPojo(Leopard));

//Add Animal.Dog  Animal.Cat

hierarchyPojo.add(dog);

hierarchyPojo.add(cat);

}


public HierarchyPojo getHierarchyPojo() {return hierarchyPojo;}


public void setHierarchyPojo(HierarchyPojo hierarchyPojo)
{this.hierarchyPojo = hierarchyPojo;}


}


Finally invoke and test...

public class App

{

public static void main( String[] args )

{

JXPathContext context = JXPathContext.newContext(new
CollectionRoot());

String query = //hierarchypo...@name='Tiger'];

String fName = context.getValue(query).toString();

System.out.println(Ran '+query+' and got '+fName+');

}

}



Above, should find one entry for 'name=Tiger' but it does not, I get an
exception. This still doesn't seem to traverse the Collection correctly. Any
help would be most welcome.
Exception in thread main
org.apache.commons.jxpath.JXPathNotFoundException: No value for xpath:
//hierarchypo...@name='Tiger']

Thanks for reading,
Andrew



On Mon, Feb 9, 2009 at 10:24 PM, Andrew Hughes ahhug...@gmail.com wrote:

 Thanks Matt - I will test this out tomorrow when I am back in the office...

 Being constructive...
 Surely this should at least be a precondition check and throw a specific
 exception if it's not supported?
 Thank You
 --Andrew


 On Mon, Feb 9, 2009 at 2:27 PM, Matt Benson gudnabr...@yahoo.com wrote:


 Most likely your problem is not with generics, but simply with the fact
 that JXPath has a hard time using a collection as its root.  The easiest
 workaround is to use some parent object to hold a reference to your
 container.

 HTH,
 Matt


 --- On Sun, 2/8/09, Andrew Hughes ahhug...@gmail.com wrote:

  From: Andrew Hughes ahhug...@gmail.com
  Subject: JXPath over Generic Collection?, How?
  To: Commons Users List user@commons.apache.org
  Date: Sunday, February 8, 2009, 5:09 PM
  Hi All,
  Hopefully the solution is as easy as the question. I would
  like to perform
  evaluation on a (very simple) generic collection... as you
  can see below
  (HeirarchyPojo). I should be able to ask for a
  HeirarchyPojo's with
  name='Bill' or the 3rd Child... The problem is that
  nothing ever evaluate on
  this data structure. What's the deal with Generic
  Collections and JXPath?
 
  p.s this is not in the userguide and would be a most
  welcomed addition (if
  we can nut this out with your help).
 
  Cheers.
 
 
  package xpath.and.generics;
 
  import java.util.ArrayList;
 
  public class HeirarchyPojo extends
  ArrayListHeirarchyPojo{
 
  public HeirarchyPojo(){}
 
  private String id;
  private String name;
 
  public String getId() {
  return id;
  }
 
  public void setId(String id) {
  this.id = id;
  }
 
  public String getName() {
  return name;
  }
 
  public void setName(String name) {
  this.name = name;
  }
 
  }




 -
 To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
 For additional commands, e-mail: user-h...@commons.apache.org





JXPath over Generic Collection?, How?

2009-02-08 Thread Andrew Hughes
Hi All,
Hopefully the solution is as easy as the question. I would like to perform
evaluation on a (very simple) generic collection... as you can see below
(HeirarchyPojo). I should be able to ask for a HeirarchyPojo's with
name='Bill' or the 3rd Child... The problem is that nothing ever evaluate on
this data structure. What's the deal with Generic Collections and JXPath?

p.s this is not in the userguide and would be a most welcomed addition (if
we can nut this out with your help).

Cheers.


package xpath.and.generics;

import java.util.ArrayList;

public class HeirarchyPojo extends ArrayListHeirarchyPojo{

public HeirarchyPojo(){}

private String id;
private String name;

public String getId() {
return id;
}

public void setId(String id) {
this.id = id;
}

public String getName() {
return name;
}

public void setName(String name) {
this.name = name;
}

}


Re: JXPath - is JXPath dead in the water?

2009-02-08 Thread Andrew Hughes
Hi Matt + Others,
Thanks for your replies! I've taken your advice and re-seeded my question on
a brand new thread with subject JXPath over Generic Collection?, How?.
If anyone can help with this I would be MOST appreciative. Also, I am happy
to contribute back to the project with examples if I can get some svn
access.

Big thanks, and hopefully you can please read my other post (fingers
crossed).

Andrew.


On Tue, Feb 3, 2009 at 9:24 AM, Matt Benson gudnabr...@yahoo.com wrote:


 --- Adrian Mitev adrian.mi...@googlemail.com wrote:

  On Mon, Feb 2, 2009 at 5:10 PM, Matt Benson
  gudnabr...@yahoo.com wrote:
  
   --- Andrew Hughes ahhug...@gmail.com wrote:
  
   Hi All,
   Is JXPath dead in the water? I can't find a post
   here in 2009 and very
   limited posts in 2008.
  
   Hi Andrew,
JXPath is considered to be in maintenance mode.
   In general, this means that this component is
   considered to be more or less complete and that
  for
   the most part, changes to the code will target
  bugs.
   Specifically with regard to JXPath, any new
  features
   considered would address shortcomings with support
  for
   the XPath 1.0 specification.  If you encounter
  issues
   with JXPath feel free to post your questions to
  this
   list; if you don't get an answer the first time
  just
   keep pushing!  ;)
  
   HTH,
   Matt
 
  Will XPath2 be supported in the near future?

 Originally that was under consideration, but to be
 honest everything I personally know about XPath (1.0)
 I learned in the course of supporting JXPath, so as
 JXPath's primary maintainer I presently don't consider
 myself capable of making such an upgrade.  There is an
 open JIRA issue for XPath 2.0 support:
 http://issues.apache.org/jira/browse/JXPATH-67;
 further if you or anyone else has ideas on this feel
 free to start a discussion thread on
 d...@commons.apache.org (the real convention on these
 mailing lists is to preface your subject with the
 component ID e.g. [jxpath] XPath 2 support).  A nice
 start might be a boiled-down list of the basic
 differences between versions 1 and 2.

 -Matt

 
 
 -
  To unsubscribe, e-mail:
  user-unsubscr...@commons.apache.org
  For additional commands, e-mail:
  user-h...@commons.apache.org
 
 





 -
 To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
 For additional commands, e-mail: user-h...@commons.apache.org




JXPath - is JXPath dead in the water?

2009-02-01 Thread Andrew Hughes
Hi All,
Is JXPath dead in the water? I can't find a post here in 2009 and very
limited posts in 2008.

Thanks.


Re: JXPath XBeanInfo Generic Collection Problem

2008-11-30 Thread Andrew Hughes
Does JXPath still have an active user/development base? I've seen very
little traffic on this list. This still does not work and I've no idea why.

On Tue, Nov 25, 2008 at 11:05 AM, Andrew Hughes [EMAIL PROTECTED] wrote:

 Everything falls apart once collections or array's are involved. I am doing
 something wrong, help would be most appreciated. I can't see any simple
 examples online and there's no doco on how to do this.
 I'm considering giving up, like the rest of the people before me.

 On Mon, Nov 24, 2008 at 12:28 PM, Andrew Hughes [EMAIL PROTECTED]wrote:

 After further testing, I have reduced the complexity of my 'Bean'. The
 'Bean' is no longer a Collection and provides getThe* methods that do not
 meet the Beans standard. Hence, JXPath must use an XBeanInfo and
 DynamicHandler to perform sucessful traversal/evalution, and it does...
 For the first time I can see  DynamicHandlerinit being called. My
 previous DynamicHandler that worked with a Collection class was never
 initialized and thus proves JXPath was never using it.

 The big question is, why? I know I can get around this by reworking my
 datastructure so that it does not extend ArrayListMyBean () but I really
 don't think I should have to do this.

 I've read a few posts with the same problem now (some as far back as
 2006). Im yet to see a solution, it looks like everyone else just decides to
 'give up' which I'd rather not do, because if this works it's a great
 solution.

 :)


 On Mon, Nov 24, 2008 at 9:49 AM, Andrew Hughes [EMAIL PROTECTED]wrote:

 After a little more investigation, I have overriden every
 Collection/ArrayList method in the PojoNode class to see how/if JXPath
 calls ANY of the inherited super methods. It does not! If JXPath is not
 traversing my data structure in any way, then it's probably not even
 evaluating it. But Im not sure why this would be, or why under such
 circumstances a mis-configuration like this does not throw any exceptions.
 As I said, I think I have exhausted the online docs and I'm getting a
 little desperate (probably sound like it too). So any help would definitely
 be appreciated. :)


 On Fri, Nov 21, 2008 at 1:42 PM, Andrew Hughes [EMAIL PROTECTED]wrote:

 Hi,
 I'm trying to work out how I can add the following PojoNode to JXPath's
 context for evaluation.

 public class PojoNode extends java.util.ArrayListPojoNode {
 public PojoNode(Pojo pojo) {
  this.pojo = pojo;
  }
  private Pojo pojo;
  public Pojo getPojo() {
  return pojo;
  }
 }



 The PojoNode tree above is (definitely) populated... then I setup and
 ask JXPath to evaluate an expression on it:


 JXPathIntrospector.registerDynamicClass(PojoNode.class,PojoDynamicPropertyHandler.class);
 JXPathContext jxPathContext = JXPathContext.newContext(rootPojoNode);
 PojoNode result = (PojoNode)jxPathContext.getValue(/); //this always
 produces an empty result


 What concerns me is not the code I have written but the code I have not.
 I've got log statements in the PojoXInfoBean and PojoDynamicPropertyHandler
 (see below) but none every fire (in particular  I have been asked to
 look.. and ...w00t).  Consequently the PojoNode tree is not being
 traversed correctly and thus fails. I suspect that because PojoNode
 implements a Collection it's picked up buy another DynamicPropertyHandler.

 I feel like I have exhausted the javadocs and any help would be very
 very much appreciated.

 Thank You.


 ps if you wanted to see more code it is below

 public class PojoNodeDynamicPropertyHandler implements
  DynamicPropertyHandler {

 private final static Logger log =
 Logger.getLogger(PojoNodeDynamicPropertyHandler.class);

 public Object getProperty(Object PojoNode, String name) {
  log.debug(I have been asked to look for '+name+');
  CollectionPojoNode hits = new ArrayListPojoNode();
  for(PojoNode childPojoNode : (PojoNode) PojoNode){
  if (childPojoNode.getPojo().getName().equals(name)){
  hits.add(childPojoNode);
  }
  }

 log.debug(I have found '+hits.size()+' instances of '+name+');
  return hits;
  }

 public String[] getPropertyNames(Object PojoNode) {
  log.debug(JXPath has asked for this, w00t!);
  HashSetString nameSet = new HashSetString();
  nameSet.addAll(collectChildNames(PojoNode));
  return (String[]) nameSet.toArray(new String[nameSet.size()]);
  }

 public void setProperty(Object arg0, String arg1, Object arg2) {
  throw new RuntimeException(
  Manipulation through JXPath is not allowed (yet));
  }

 private HashSetString collectChildNames(Object PojoNode) {
  HashSetString nameSet = new HashSetString();
  for (PojoNode childPojo : (PojoNode) PojoNode) {
  nameSet.add(childPojo.getPojo().getName());
  }
  return nameSet;
  }

 }

 

 public class PojoNodeXBeanInfo implements JXPathBeanInfo{

   private static final Logger log =
 Logger.getLogger(PojoNodeXBeanInfo.class);


 public ClassPojoNodeDynamicPropertyHandler

Re: JXPath XBeanInfo Generic Collection Problem

2008-11-24 Thread Andrew Hughes
Everything falls apart once collections or array's are involved. I am doing
something wrong, help would be most appreciated. I can't see any simple
examples online and there's no doco on how to do this.
I'm considering giving up, like the rest of the people before me.

On Mon, Nov 24, 2008 at 12:28 PM, Andrew Hughes [EMAIL PROTECTED] wrote:

 After further testing, I have reduced the complexity of my 'Bean'. The
 'Bean' is no longer a Collection and provides getThe* methods that do not
 meet the Beans standard. Hence, JXPath must use an XBeanInfo and
 DynamicHandler to perform sucessful traversal/evalution, and it does...
 For the first time I can see  DynamicHandlerinit being called. My
 previous DynamicHandler that worked with a Collection class was never
 initialized and thus proves JXPath was never using it.

 The big question is, why? I know I can get around this by reworking my
 datastructure so that it does not extend ArrayListMyBean () but I really
 don't think I should have to do this.

 I've read a few posts with the same problem now (some as far back as 2006).
 Im yet to see a solution, it looks like everyone else just decides to 'give
 up' which I'd rather not do, because if this works it's a great solution.

 :)


 On Mon, Nov 24, 2008 at 9:49 AM, Andrew Hughes [EMAIL PROTECTED] wrote:

 After a little more investigation, I have overriden every
 Collection/ArrayList method in the PojoNode class to see how/if JXPath
 calls ANY of the inherited super methods. It does not! If JXPath is not
 traversing my data structure in any way, then it's probably not even
 evaluating it. But Im not sure why this would be, or why under such
 circumstances a mis-configuration like this does not throw any exceptions.
 As I said, I think I have exhausted the online docs and I'm getting a
 little desperate (probably sound like it too). So any help would definitely
 be appreciated. :)


 On Fri, Nov 21, 2008 at 1:42 PM, Andrew Hughes [EMAIL PROTECTED]wrote:

 Hi,
 I'm trying to work out how I can add the following PojoNode to JXPath's
 context for evaluation.

 public class PojoNode extends java.util.ArrayListPojoNode {
 public PojoNode(Pojo pojo) {
  this.pojo = pojo;
  }
  private Pojo pojo;
  public Pojo getPojo() {
  return pojo;
  }
 }



 The PojoNode tree above is (definitely) populated... then I setup and ask
 JXPath to evaluate an expression on it:


 JXPathIntrospector.registerDynamicClass(PojoNode.class,PojoDynamicPropertyHandler.class);
 JXPathContext jxPathContext = JXPathContext.newContext(rootPojoNode);
 PojoNode result = (PojoNode)jxPathContext.getValue(/); //this always
 produces an empty result


 What concerns me is not the code I have written but the code I have not.
 I've got log statements in the PojoXInfoBean and PojoDynamicPropertyHandler
 (see below) but none every fire (in particular  I have been asked to
 look.. and ...w00t).  Consequently the PojoNode tree is not being
 traversed correctly and thus fails. I suspect that because PojoNode
 implements a Collection it's picked up buy another DynamicPropertyHandler.

 I feel like I have exhausted the javadocs and any help would be very very
 much appreciated.

 Thank You.


 ps if you wanted to see more code it is below

 public class PojoNodeDynamicPropertyHandler implements
  DynamicPropertyHandler {

 private final static Logger log =
 Logger.getLogger(PojoNodeDynamicPropertyHandler.class);

 public Object getProperty(Object PojoNode, String name) {
  log.debug(I have been asked to look for '+name+');
  CollectionPojoNode hits = new ArrayListPojoNode();
  for(PojoNode childPojoNode : (PojoNode) PojoNode){
  if (childPojoNode.getPojo().getName().equals(name)){
  hits.add(childPojoNode);
  }
  }

 log.debug(I have found '+hits.size()+' instances of '+name+');
  return hits;
  }

 public String[] getPropertyNames(Object PojoNode) {
  log.debug(JXPath has asked for this, w00t!);
  HashSetString nameSet = new HashSetString();
  nameSet.addAll(collectChildNames(PojoNode));
  return (String[]) nameSet.toArray(new String[nameSet.size()]);
  }

 public void setProperty(Object arg0, String arg1, Object arg2) {
  throw new RuntimeException(
  Manipulation through JXPath is not allowed (yet));
  }

 private HashSetString collectChildNames(Object PojoNode) {
  HashSetString nameSet = new HashSetString();
  for (PojoNode childPojo : (PojoNode) PojoNode) {
  nameSet.add(childPojo.getPojo().getName());
  }
  return nameSet;
  }

 }

 

 public class PojoNodeXBeanInfo implements JXPathBeanInfo{

   private static final Logger log =
 Logger.getLogger(PojoNodeXBeanInfo.class);


 public ClassPojoNodeDynamicPropertyHandler
 getDynamicPropertyHandlerClass() {

  log.debug(JXPath has asked for this, w00t!);

  return PojoNodeDynamicPropertyHandler.class;

  }


  public PropertyDescriptor getPropertyDescriptor(String arg0) {

  log.debug(JXPath has asked

Re: JXPath and LazyDynaBeans

2008-11-23 Thread Andrew Hughes
The code above should work, returning a number of absolute pointers to
'car'. You can copy/past it if you feel like it.
I'd expect to see something printed out like:

Got pointer: /car[0]
Got pointer: /car[1]
Got pointer: /car[2]

:'(


On Sat, Nov 22, 2008 at 5:15 AM, Niall Pemberton
[EMAIL PROTECTED]wrote:

 On Thu, Nov 20, 2008 at 12:10 AM, Andrew Hughes [EMAIL PROTECTED]
 wrote:
  Hi All,
 
  There are so many options here, I'm not sure which one is the
 easiest/best
  solution. I've got a data structure which I am using to populate (a
  hierarchy of)  LazyDynaBean's so that we can run JXPath across it. It's
  working perfectly, until I try and introduce duplicate key entries (i.e.
 a
  node can have 1 children of the same name).
 
  My example heirarchy I wish to build is this...
 
  /
  /car='Ferrari'
  /car='Porsche'
  /car=Lamborghini'
 
 
  In xml it might look like...
 
  root
 carFerrari/car
 carPorsche/car
 carLamborghini/car
  /root
 
 
  Anyway, to cut to the chase. I have multiple 'car' property entries and I
 am
  trying to run the follwing code:
 
  LazyDynaBean lazyDynaBean = new LazyDynaBean();
  JXPathContext jxPathContext = JXPathContext.newContext(lazyDynaBean);
  lazyDynaBean.set(car,0, Ferrari);
  lazyDynaBean.set(car,1, Porsche);
  lazyDynaBean.set(car,2, Lamborghini);
  Iterator i = jxPathContext.iteratePointers(car);
  while(i.hasNext()){
  System.out.println(Got pointer: +i.next().toString());
  }
 
 
  The error is:
 
  Exception in thread main java.lang.ArrayIndexOutOfBoundsException: 0
  at
 
 org.apache.commons.jxpath.ri.model.dynabeans.DynaBeanPropertyPointer.getPropertyNames(DynaBeanPropertyPointer.java:84)
  at
 
 org.apache.commons.jxpath.ri.model.beans.PropertyIterator.prepareForIndividualProperty(PropertyIterator.java:270)
  at
 
 org.apache.commons.jxpath.ri.model.beans.PropertyIterator.setPositionIndividualProperty(PropertyIterator.java:154)
  at
 
 org.apache.commons.jxpath.ri.model.beans.PropertyIterator.setPosition(PropertyIterator.java:139)
  at
 
 org.apache.commons.jxpath.ri.axes.ChildContext.setPosition(ChildContext.java:101)
  at
 
 org.apache.commons.jxpath.ri.axes.ChildContext.nextNode(ChildContext.java:87)
  at
 
 org.apache.commons.jxpath.ri.EvalContext.performIteratorStep(EvalContext.java:155)
  at org.apache.commons.jxpath.ri.EvalContext.hasNext(EvalContext.java:115)
  at rnd.JXPathRND.App.main(App.java:24)
 
 
  How am I supposed to populate the DynaBean so that it can contain more
 than
  one 'car' property?

 I would have expected the lazy DynaBean to contain a list of Strings -
 I would check if it does. If it does then the issue is in JXPath.

 Niall

  Also, I would prefer not to have to specify the index 0,1,2 if that is at
  all possible.
 
  Thanks in advance.
 

 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]




Re: JXPath XBeanInfo Generic Collection Problem

2008-11-23 Thread Andrew Hughes
After further testing, I have reduced the complexity of my 'Bean'. The
'Bean' is no longer a Collection and provides getThe* methods that do not
meet the Beans standard. Hence, JXPath must use an XBeanInfo and
DynamicHandler to perform sucessful traversal/evalution, and it does...
For the first time I can see  DynamicHandlerinit being called. My
previous DynamicHandler that worked with a Collection class was never
initialized and thus proves JXPath was never using it.

The big question is, why? I know I can get around this by reworking my
datastructure so that it does not extend ArrayListMyBean () but I really
don't think I should have to do this.

I've read a few posts with the same problem now (some as far back as 2006).
Im yet to see a solution, it looks like everyone else just decides to 'give
up' which I'd rather not do, because if this works it's a great solution.

:)


On Mon, Nov 24, 2008 at 9:49 AM, Andrew Hughes [EMAIL PROTECTED] wrote:

 After a little more investigation, I have overriden every
 Collection/ArrayList method in the PojoNode class to see how/if JXPath
 calls ANY of the inherited super methods. It does not! If JXPath is not
 traversing my data structure in any way, then it's probably not even
 evaluating it. But Im not sure why this would be, or why under such
 circumstances a mis-configuration like this does not throw any exceptions.
 As I said, I think I have exhausted the online docs and I'm getting a
 little desperate (probably sound like it too). So any help would definitely
 be appreciated. :)


 On Fri, Nov 21, 2008 at 1:42 PM, Andrew Hughes [EMAIL PROTECTED] wrote:

 Hi,
 I'm trying to work out how I can add the following PojoNode to JXPath's
 context for evaluation.

 public class PojoNode extends java.util.ArrayListPojoNode {
 public PojoNode(Pojo pojo) {
  this.pojo = pojo;
  }
  private Pojo pojo;
  public Pojo getPojo() {
  return pojo;
  }
 }



 The PojoNode tree above is (definitely) populated... then I setup and ask
 JXPath to evaluate an expression on it:


 JXPathIntrospector.registerDynamicClass(PojoNode.class,PojoDynamicPropertyHandler.class);
 JXPathContext jxPathContext = JXPathContext.newContext(rootPojoNode);
 PojoNode result = (PojoNode)jxPathContext.getValue(/); //this always
 produces an empty result


 What concerns me is not the code I have written but the code I have not.
 I've got log statements in the PojoXInfoBean and PojoDynamicPropertyHandler
 (see below) but none every fire (in particular  I have been asked to
 look.. and ...w00t).  Consequently the PojoNode tree is not being
 traversed correctly and thus fails. I suspect that because PojoNode
 implements a Collection it's picked up buy another DynamicPropertyHandler.

 I feel like I have exhausted the javadocs and any help would be very very
 much appreciated.

 Thank You.


 ps if you wanted to see more code it is below

 public class PojoNodeDynamicPropertyHandler implements
  DynamicPropertyHandler {

 private final static Logger log =
 Logger.getLogger(PojoNodeDynamicPropertyHandler.class);

 public Object getProperty(Object PojoNode, String name) {
  log.debug(I have been asked to look for '+name+');
  CollectionPojoNode hits = new ArrayListPojoNode();
  for(PojoNode childPojoNode : (PojoNode) PojoNode){
  if (childPojoNode.getPojo().getName().equals(name)){
  hits.add(childPojoNode);
  }
  }

 log.debug(I have found '+hits.size()+' instances of '+name+');
  return hits;
  }

 public String[] getPropertyNames(Object PojoNode) {
  log.debug(JXPath has asked for this, w00t!);
  HashSetString nameSet = new HashSetString();
  nameSet.addAll(collectChildNames(PojoNode));
  return (String[]) nameSet.toArray(new String[nameSet.size()]);
  }

 public void setProperty(Object arg0, String arg1, Object arg2) {
  throw new RuntimeException(
  Manipulation through JXPath is not allowed (yet));
  }

 private HashSetString collectChildNames(Object PojoNode) {
  HashSetString nameSet = new HashSetString();
  for (PojoNode childPojo : (PojoNode) PojoNode) {
  nameSet.add(childPojo.getPojo().getName());
  }
  return nameSet;
  }

 }

 

 public class PojoNodeXBeanInfo implements JXPathBeanInfo{

   private static final Logger log =
 Logger.getLogger(PojoNodeXBeanInfo.class);


 public ClassPojoNodeDynamicPropertyHandler
 getDynamicPropertyHandlerClass() {

  log.debug(JXPath has asked for this, w00t!);

  return PojoNodeDynamicPropertyHandler.class;

  }


  public PropertyDescriptor getPropertyDescriptor(String arg0) {

  log.debug(JXPath has asked for this, w00t!);

  return null;

 }


 public PropertyDescriptor[] getPropertyDescriptors() {

  log.debug(JXPath has asked for this, w00t!);

  return null;

  }


  public boolean isAtomic() {

 log.debug(JXPath has asked for this, w00t!);

  return false;

  }


  public boolean isDynamic() {

 log.debug(JXPath has asked for this, w00t!);

  return true;

  }

  }










JXPath and LazyDynaBeans

2008-11-19 Thread Andrew Hughes
Hi All,

There are so many options here, I'm not sure which one is the easiest/best
solution. I've got a data structure which I am using to populate (a
hierarchy of)  LazyDynaBean's so that we can run JXPath across it. It's
working perfectly, until I try and introduce duplicate key entries (i.e. a
node can have 1 children of the same name).

My example heirarchy I wish to build is this...

/
/car='Ferrari'
/car='Porsche'
/car=Lamborghini'


In xml it might look like...

root
carFerrari/car
carPorsche/car
carLamborghini/car
/root


Anyway, to cut to the chase. I have multiple 'car' property entries and I am
trying to run the follwing code:

 LazyDynaBean lazyDynaBean = new LazyDynaBean();
 JXPathContext jxPathContext = JXPathContext.newContext(lazyDynaBean);
 lazyDynaBean.set(car,0, Ferrari);
 lazyDynaBean.set(car,1, Porsche);
 lazyDynaBean.set(car,2, Lamborghini);
 Iterator i = jxPathContext.iteratePointers(car);
 while(i.hasNext()){
 System.out.println(Got pointer: +i.next().toString());
 }


The error is:

Exception in thread main java.lang.ArrayIndexOutOfBoundsException: 0
at
org.apache.commons.jxpath.ri.model.dynabeans.DynaBeanPropertyPointer.getPropertyNames(DynaBeanPropertyPointer.java:84)
at
org.apache.commons.jxpath.ri.model.beans.PropertyIterator.prepareForIndividualProperty(PropertyIterator.java:270)
at
org.apache.commons.jxpath.ri.model.beans.PropertyIterator.setPositionIndividualProperty(PropertyIterator.java:154)
at
org.apache.commons.jxpath.ri.model.beans.PropertyIterator.setPosition(PropertyIterator.java:139)
at
org.apache.commons.jxpath.ri.axes.ChildContext.setPosition(ChildContext.java:101)
at
org.apache.commons.jxpath.ri.axes.ChildContext.nextNode(ChildContext.java:87)
at
org.apache.commons.jxpath.ri.EvalContext.performIteratorStep(EvalContext.java:155)
at org.apache.commons.jxpath.ri.EvalContext.hasNext(EvalContext.java:115)
at rnd.JXPathRND.App.main(App.java:24)


How am I supposed to populate the DynaBean so that it can contain more than
one 'car' property?
Also, I would prefer not to have to specify the index 0,1,2 if that is at
all possible.

Thanks in advance.


Re: JXPath and Custom Graphs

2008-11-18 Thread Andrew Hughes
Thanks Carsten for the reply!
I must admit I am still a little unsure how I can resolve my problem. Most
of what I am dealing with exists in an event driven model. We start with a
root object and we then register listeners on child object creation. Then
its children, and its and so forth...

getRootObject().addChildCreationListener(new ChildCreationListener(){
onCreate(TheObject obj){..do something with the new leaf/node/child..});

Since this is all event driven I can't see how a JXPathBeanInfo would
'easily' be able to traverse 'children' as they aren't stored in the parent
object. What I was thinking is that as object's are created the listeners
take the newly created leaf/child objects and inject it into the context (or
maybe into a dynabean sitting in the context).

What I'm hoping, is that as objects are created and the creation listener is
invoked the creation listener can then inject the new node and create its
path in the JXPathContext (as below).
JXPathContext.createPathAndSetValue(parentPath+/+obj.getName(), obj);


There's a few things I don't quite know tho

   1. Is this a good option?
   2. How can I remove a path and it's value when it disappears? Do I set
   the path to null???
   3. Is this going to get really bad performance?


Your advice is MUCH APPRECIATED, I'm very impressed with JXPath so far!


On Tue, Nov 18, 2008 at 2:20 AM, Carsten Schlipf [EMAIL PROTECTED]wrote:

 If I understand you right, a JXPathBeanInfo implementation for you classes
 will solve this problem for you:


 http://commons.apache.org/jxpath/apidocs/org/apache/commons/jxpath/JXPathBeanInfo.html

 This allows to map property names to arbitrary functions in your pojo as
 well as hiding properties that shall not be exposed.

 Regards,
 Carsten


 Andrew Hughes wrote:

 Hi All,
 We've got an existing 'graph' of dynamic pojo's. This is effectively a
 root
 node, with sibling child node(S), and inturn they have child node(s) (so
 your typical tree/graph). Ideally we would like to run xpath
 expression/evalution on our dynamic graph. The objects we're storing do
 not
 meet the beans or dyna beans standard. I know there are a few options here
 and to be quite honest I'm not sure which option is the best.

 I believe my options are to wrap/store the existing pojo's inside a
 bean/dynabean standard wrapping pojo's. Alternatively, I can do some work
 that will provide JXPath with the ability to traverse our current 'graph'
 and hence evaluate XPath expressions. I would much prefer the second
 option
 (if possible).

 Finally there's the gotcha. As our 'graph' is dynamic and just as nodes
 are
 created at runtime they are also destroyed and it would be nice to have
 JXPath as an observer (not maintainer) of the graph.

 Any advice/help would be much appreciated :)

 Thanks,
 Andrew






JXPath and Custom Graphs

2008-11-16 Thread Andrew Hughes
Hi All,
We've got an existing 'graph' of dynamic pojo's. This is effectively a root
node, with sibling child node(S), and inturn they have child node(s) (so
your typical tree/graph). Ideally we would like to run xpath
expression/evalution on our dynamic graph. The objects we're storing do not
meet the beans or dyna beans standard. I know there are a few options here
and to be quite honest I'm not sure which option is the best.

I believe my options are to wrap/store the existing pojo's inside a
bean/dynabean standard wrapping pojo's. Alternatively, I can do some work
that will provide JXPath with the ability to traverse our current 'graph'
and hence evaluate XPath expressions. I would much prefer the second option
(if possible).

Finally there's the gotcha. As our 'graph' is dynamic and just as nodes are
created at runtime they are also destroyed and it would be nice to have
JXPath as an observer (not maintainer) of the graph.

Any advice/help would be much appreciated :)

Thanks,
Andrew