commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Neil Benn" <>
Subject JXPath Modelling
Date Sun, 11 Mar 2007 16:18:33 GMT

      Sorry to ask more questions on JXPath syntax.  I ahev the curretn use

[the following bit is pseudo code

public class Question{

  public String getID();
  public String getAnswer();

public class User{

  //this will return a question stored by the ID
  public string getQuestion(String pstrID);
  //this will add a question and store it by ID
  public String addQuestion(Question pobjQuestion);

  So what I want to do is to pass a list of users to a class, including a
bunch of JXPath expressions so I can extract teh data I need in a flexible
way.  So (after help from people here - thanks) I made the following
expression to get a question from the user such as : 

getQuestion(., 'firstname')

This indeed returns me a question as i would expect and I can print this to my
log with no problems.  So to get the answer, I tried : 

getQuestion(.[1], 'firstname').answer

this gives me a bad syntax error, I also tried : 

getAnswer(getQuestion(.[1], 'firstname)

  This works but it feels a bit a bit weird calling a get method with JXPath. 
Am I doing this in the correct way or is there a 'more elegant' way of doing

  Thanks, in advance for your help.



Neil Benn Msc
CEO Ziath Ltd
Website -
Blog -

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message