OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

 


 

   XPath problem with selectSingleNode in MSXML4

[ Lists Home | Date Index | Thread Index ]

I have a file called config.xml like this:

 <?xml version="1.0"?>
 <config>
  <link href="tree.asp"/>
  <link href="search.asp" default="true" />
 </config>

This Javascript ASP code finds the href with the "default=true" attribute:

 var xmldoc = new ActiveXObject("MSXML2.DOMDocument.4.0");
 xmldoc.async = false;
 xmldoc.load(Server.MapPath("config.xml"));
 xmldoc.setProperty("SelectionLanguage", "XPath");
 var defaultpage = xmldoc.selectSingleNode("/config/link[@default]");
 var href = defaultpage.getAttribute("href");

My question is, why doesn't this code find it as well?

 var xmldoc = new ActiveXObject("MSXML2.DOMDocument.4.0");
 xmldoc.async = false;
 xmldoc.load(Server.MapPath("config.xml"));
 xmldoc.setProperty("SelectionLanguage", "XPath");
 var href = xmldoc.selectSingleNode("/config/link[@default]/@href");

Thanks,
John Sands

__________________________________________________
Do You Yahoo!?
Yahoo! Tax Center - online filing with TurboTax
http://taxes.yahoo.com/




 

News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 2001 XML.org. This site is hosted by OASIS