Article ID: 290988 - Last Review: October 16, 2002 - Revision: 1.4

FIX: Error Using getProperty Method of XMLDOMSelection with SelectionNamespaces

This article was previously published under Q290988

On This Page

Expand all | Collapse all

SYMPTOMS

When you use the getProperty method of a nodelist to retrieve the SelectionNamespaces property of a XMLDOMSelection object, you may receive the following error message:
-2147467259 Property name is invalid.

STATUS

Microsoft has confirmed that this is a problem in the Microsoft products that are listed at the beginning of this article.

This bug was corrected in Microsoft XML 3.0 Service Pack 1.

For additional information on other fixes included in Microsoft XML 3.0 Service Pack 1, click the article number below to view the article in the Microsoft Knowledge Base:
292935  (http://support.microsoft.com/kb/292935/EN-US/ ) INFO: List of Issues Fixed in Microsoft XML 3.0 Service Pack 1
For the latest information and downloads of MSXML, refer to the following MSDN Web site at:
http://msdn.microsoft.com/xml/default.asp (http://msdn.microsoft.com/xml/default.asp)

MORE INFORMATION

Steps to Reproduce Behavior

  1. Create a sample XML file:
    1. Create a new text document by using Windows Notepad or another text editor.
    2. Paste the following code into the new text document:
       <?xml version="1.0"?>
          <books>
          <book>
            <title>XML Step by Step</title>
          </book>
          <book>
            <title>Developing XML Solutions</title>
          </book>
         </books>
      						
    3. Save the file as Books.xml in the home folder of your default Web site (this is typically C:\InetPub\WWWRoot).
  2. Create a sample Windows script:
    1. Create a new text document by using Windows Notepad or another text editor.
    2. Paste the following code into the new text document:
       var xmlDoc = new ActiveXObject("msxml2.domdocument");
       xmlDoc.async = false;
       xmlDoc.load("http://localhost/books.xml");
      
       xmlDoc.setProperty("SelectionLanguage", "XPath");
       xmlDoc.setProperty("SelectionNamespaces", "xmlns:my='urn:http//www.my.com/schema/'");
       var nodelist = xmlDoc.documentElement.selectNodes("child::my:book");
      
       var stExpected = "xmlns:my='urn:http//www.my.com/schema/'";
       var stActual;
       try
        {
          stActual = nodelist.getProperty("SelectionNamespaces");
        }
       catch(e)
        {
         WScript.Echo("Should not have an error:" + e.number + e.description);
        }
      		
        WScript.Echo(stExpected==stActual);
      						
    3. Save the document as C:\getProperty.js.
  3. At a command prompt, execute the script by using the following command:
    cscript C:\getProperty.JS
You receive the "Property name is invalid" error message.

APPLIES TO
  • Microsoft XML Parser 3.0
Keywords: 
kbbug kbfix kbfix kbmsxml300sp1fix kbmsxmlnosweep KB290988
 

Article Translations