You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by Neil Benn <ne...@ziath.com> on 2007/03/11 17:18:33 UTC
JXPath Modelling
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
Re: JXPath Modelling
Posted by Dmitri Plotnikov <dm...@apache.org>.
Neil,
The problem may be the dot in the expression.
Try this:
getQuestion(.[1], 'firstname')/answer
Regards,
- Dmitri
----- Original Message -----
From: "Neil Benn" <ne...@ziath.com>
To: <co...@jakarta.apache.org>
Sent: Sunday, March 11, 2007 12:18 PM
Subject: JXPath Modelling
> 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
>
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org