XPath supports variables.
//foo[@doo=$bob_is_a_goober]
Then, using a VariableContext, you can assign whatever value you
with to the variable "bob_is_a_goober".
-bob
(goober)
On Fri, 3 May 2002, Christian Holmqvist, IT, Posten wrote:
> Hi
>
> Is it possible to use XPath expressions as prepared statements?
>
> Example
> This is what I do now.
>
> public final static String XPATH_EXP = "//foo[@doo=?]";
> ....
> XPath xp = DocumentHelper.createXPath(XPATH_EXP.replace('?','1'));
> The problem with this is that replace only handles char... kind of
> limiting...
>
> I know it is possible to make it more complex.... but...
>
> What I would like to do is to define the XPath as
>
> public final static XPath XPATH_EXP =
> DocumentHelper.createXPath("//foo[@doo=?]");
> ...
> XPATH_EXP.setString(1, "foo");
> XPATH_EXP.selectNodes(doc);
> XPATH_EXP.setString(1, "oof");
> XPATH_EXP.selectNodes(doc);
>
> Is this possible, or have I missed something fundamental?
>
> /Cheers Christian
>
> _______________________________________________________________
>
> Have big pipes? SourceForge.net is looking for download mirrors. We supply
> the hardware. You get the recognition. Email Us: [EMAIL PROTECTED]
> _______________________________________________
> dom4j-user mailing list
> [EMAIL PROTECTED]
> https://lists.sourceforge.net/lists/listinfo/dom4j-user
>
_______________________________________________________________
Have big pipes? SourceForge.net is looking for download mirrors. We supply
the hardware. You get the recognition. Email Us: [EMAIL PROTECTED]
_______________________________________________
dom4j-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/dom4j-user