Article ID: 310711 - Last Review: November 15, 2007 - Revision: 1.6

FIX: Enumerating Collection of Nodes May Fail Silently on Second Iteration

Hotfix download is availableHotfix Download Available
View and request hotfix downloads
This article was previously published under Q310711
Expand all | Collapse all

SYMPTOMS

When you iterate a collection of nodes that are provided by an IXMLDOMNodeList interface, the first iteration may work, but the second iteration may behave as if the collection is empty and fail without an error message.

CAUSE

This problem occurs when you iterate a collection of nodes (such as those that are returned by a selectNodes call) by using an IXMLDOMNodeList interface that is obtained from a DOMDocument or a node from a DOMDocument. The problem occurs if the node or document that provides the nodes exists in a different COM+ context, COM apartment, or process; for example, the problem occurs if the IXMLDOMNodeList interface in question has been marshalled. The problem does not occur if you are using the FreeThreadedDOMDocument class and the interaction is within the same process because the FreeThreadedDOMDocument class aggregates the Free-Threaded Marshaller.

RESOLUTION

A supported hotfix is available from Microsoft. However, this hotfix is intended to correct only the problem that is described in this article. Apply this hotfix only to systems that are experiencing this specific problem. This hotfix might receive additional testing. Therefore, if you are not severely affected by this problem, we recommend that you wait for the next software update that contains this hotfix.

If the hotfix is available for download, there is a "Hotfix download available" section at the top of this Knowledge Base article. If this section does not appear, contact Microsoft Customer Service and Support to obtain the hotfix.

Note If additional issues occur or if any troubleshooting is required, you might have to create a separate service request. The usual support costs will apply to additional support questions and issues that do not qualify for this specific hotfix. For a complete list of Microsoft Customer Service and Support telephone numbers or to create a separate service request, visit the following Microsoft Web site:
http://support.microsoft.com/contactus/?ws=support (http://support.microsoft.com/contactus/?ws=support)
Note The "Hotfix download available" form displays the languages for which the hotfix is available. If you do not see your language, it is because a hotfix is not available for that language.NOTE: This fix is not available for MSXML version 2.6 (Msxml2.dll) or MSXML version 4.0 (Msxml4.dll).

The English version of this fix should have the following file attributes or later:
   File name    Size (bytes)  Date         Version 
   ---------------------------------------------------

   Msxml3.dll   1,108,480     15-Oct-2001  8.10.9015.0
   Msxml3a.dll     24,576     15-Oct-2001  8.10.9015.0
   Msxml3r.dll     44,032     15-Oct-2001  8.10.9015.0
   Xmlinst.exe     28,672     15-Oct-2001  6.0.2462.0

				

WORKAROUND

To work around this problem, do any of the following:
  • Use FreeThreadedDOMDocument if the interaction is within the same process.
  • Avoid marshalling the interface. Instead, pass a string representation of the XML concerned. In many cases this is a better way to pass XML between components.
  • Avoid situations in which you must iterate the collection a second time.
  • Reobtain the IXMLDOMNodeList (that is, run the selectNodes call again).

STATUS

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

APPLIES TO
  • Microsoft XML Parser 2.6
  • Microsoft XML Parser 3.0
  • Microsoft XML Parser 3.0 Service Pack 1
  • Microsoft XML Parser 3.0 Service Pack 2
  • Microsoft XML Core Services 4.0
Keywords: 
kbautohotfix kbhotfixserver kbqfe kbprb kbqfe KB310711
 

Article Translations