commons-user mailing list archives

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

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

[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
this?

  Thanks, in advance for your help.

Cheers,

Neil
---

Neil Benn Msc
CEO Ziath Ltd
Website - http://www.ziath.com
Blog - http://labauto-lounge.com




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