FIX: Oncellchange() Event of the XML DSO Fires Twice (262610)



The information in this article applies to:

  • Microsoft XML 2.0

This article was previously published under Q262610

SYMPTOMS

The oncellchange() event of the XML Data Source Object (DSO) is fired when the value of an XML data element is modified in scripting code. This event fires twice in succession in MSXML 2.0, which is not the desired behavior.

STATUS

Microsoft has confirmed this to be a bug in the Microsoft products listed at the beginning of this article.

This problem has been fixed in the MSXML 2.5 parser.

You can obtain the most current parser update on the MSDN page at the following Microsoft Web site:

MORE INFORMATION

In the following code, the XML DSO is used to bind an XML data island to an HTML table. The VBScript procedure Notify() in the SCRIPT tag is run when the oncellchange() event of the DSO is fired.

The onClick() event of the Change Name button element on the HTML page triggers the VBScript changename() procedure in the SCRIPT tag. The changename() procedure modifies the text of the Name element in the XML data, which causes the oncellchange() event of the XML DSO to fire and the VBScript Notify() procedure to run.

Steps to Reproduce Behavior

  1. Cut and paste the following code into a text file in Microsoft Notepad and save it as CellChangeTest.htm in a folder on your hard drive:
    <html>
    <body>
    
    <SCRIPT Language="VBScript">
    Sub changename()
      xmldso.XMLDocument.selectSingleNode("//Name").text = "David"
    End Sub
    
    Sub Notify()
      Msgbox "Name has changed"
    End Sub
    </SCRIPT>
    
    <xml id="xmldso" oncellchange="Notify">
    <People>
    	<Person>
    		<Name>John</Name>
    		<Phone>727-879-8765</Phone>
    		<Email>john@xyz.com</Email>
    	</Person>
    </People>
    </xml>
    
    <table datasrc=#xmldso border=1>
    <thead>
     <th>Name</th>
     <th>Phone</th>
     <th>Email</th>
    </thead>
    <tr>
     <td><div datafld="Name"></div></td>
     <td><div datafld="Phone"></div></td>
     <td><div datafld="Email"></div></td> 
    </tr>
    </table>
    
    <p><input type="Button" value="Change Name" onClick="changename">
    
    </body>
    </html>
    					
  2. Open CellChangeTest.htm in Internet Explorer, and note that the page displays an HTML table that is bound to the XML data.
  3. Click the Change Name button, and note that the message box that contains the Name has changed text is displayed twice in succession.

Modification Type:MajorLast Reviewed:10/15/2002
Keywords:kbBug kbDSupport kbMSXML250fix KB262610