[jdom-interest] variable evaluation in XPATH expression
Alastair Rodgers
alastair.rodgers at phocis.com
Thu Jan 22 02:22:37 PST 2004
Something like the following should do it:
XPath xpath = new JDOMXPath("/*/*/subcategory[@mappedname=$map]");
SimpleVariableContext vars = new SimpleVariableContext();
vars.setVariableValue(null, "map", "europe");
xpath.setVariableContext(vars);
Element result = (Element)xpath.selectSingleNode(doc);
Al.
-----Original Message-----
From: jdom-interest-admin at jdom.org [mailto:jdom-interest-admin at jdom.org] On Behalf Of Prashanth.S
Sent: 22 January 2004 03:11
To: jdom-interest at jdom.org
Subject: [jdom-interest] variable evaluation in XPATH expression
Hi all,
Iam using jdom for xml parsing....so to search a particular element in a xml iam using XPATH and iam trying to construct XPATH expression dynamically....is it possible to use variables inside XPATH expression....like
String map="europe";
XPath servletPath = XPath.newInstance("/*/*/subcategory[@mappedname=map]");
Iam eagerly waiting for reply...
Thanks
Prashanth
Do you Yahoo!?
Yahoo! SiteBuilder - Free web site building tool. Try it!
More information about the jdom-interest
mailing list