Altova Mailing List Archives>Archive Index >microsoft.public.xml Archive Home >Recent entries >Thread Prev - pass parameter with Jscript >Thread Next - Re: pass parameter with Jscript Re: pass parameter with JscriptTo: NULL Date: 4/7/2007 6:22:00 PM
Ghena wrote:
> var xmldom = new ActiveXObject("Microsoft.XMLDOM");
> xmldom.async = false;
> xmldom.load(Server.MapPath("tutte_ctg.xml"));
> var leggi = xmldom.getElementsByTagName("BuildSearchForm/
> Categories/Category[ID = id]/Name");
If you want to use XPath then first set
xmldom.setProperty('SelectionLanguage', 'XPath');
then don't use getElementsByTagName, use selectNodes e.g.
var leggi = xmldom.selectNodes(xpathExpression);
If you want to use the id variable in the XPath expression then you need
to use string concatenation
var leggi =
xmldom.selectNodes("BuildSearchForm/Categories/Category[ID = " + id +
"]/Name");
As you seem to have white space in your ID elements you furthermore need
var leggi = xmldom.selectNodes(
"BuildSearchForm/Categories/Category[normalize-space(ID) = " + id +
"]/Name");
--
Martin Honnen --- MVP XML
http://JavaScript.FAQTs.com/
| ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
