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

 


Help: OASIS Mailing Lists Help | MarkMail Help

 


 

   RE: [xml-dev] XPath problem with selectSingleNode in MSXML4

[ Lists Home | Date Index | Thread Index ]
  • To: Dare Obasanjo <dareo@microsoft.com>
  • Subject: RE: [xml-dev] XPath problem with selectSingleNode in MSXML4
  • From: John Sands <wonkowatson@yahoo.com>
  • Date: Mon, 8 Apr 2002 13:53:42 -0700 (PDT)
  • Cc: xml-dev@lists.xml.org
  • In-reply-to: <8BD7226E07DDFF49AF5EF4030ACE0B7E05573C64@red-msg-06.redmond.corp.microsoft.com>

Thanks for letting me know it's a bug. I found that my XPath expression -
"/config/link[@default]/@href" - worked in Aaron Skonnard's very useful XPath
Expression Builder
(http://staff.develop.com/aarons/bits/xpath-expression-builder-4.0/) which
seemed funny because it uses MXSML4, so I looked at his code. He uses
selectNodes, of course, so I tried that and it worked:

  var href = xmldoc.selectNodes("/config/link[@default]/@href")[0].value;


--- Dare Obasanjo <dareo@microsoft.com> wrote:
> This is a bug in our implementation which should fixed in a future
> release. 
> 
> Thanks for bringing it to our attention. 
> 
> PS: The behavior is implemented correctly in the .NET XmlDocument class
> which can be used in ASP.NET if you plan to adopt it. 
> 
> -- 
> PITHY WORDS OF WISDOM 
> A journey of a thousand miles begins with a cash advance.
>  
> This posting is provided "AS IS" with no warranties, and confers no
> rights. 
> You assume all risk for your use. (c) 2002 Microsoft Corporation. All
> rights reserved.
> 
> 
> 
> > -----Original Message-----
> > From: John Sands [mailto:wonkowatson@yahoo.com] 
> > Sent: Sunday, April 07, 2002 8:46 PM
> > To: xml-dev@lists.xml.org
> > Subject: [xml-dev] XPath problem with selectSingleNode in MSXML4
> > 
> > 
> > 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