Microsoft KB Archive/310711

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

Article ID: 310711

Article Last Modified on 11/15/2007

-

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

-



This article was previously published under Q310711



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 now 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 service pack that contains this hotfix.

To resolve this problem, submit a request to Microsoft Online Customer Services to obtain the hotfix. To submit an online request to obtain the hotfix, visit the following Microsoft Web site:

http://go.microsoft.com/?linkid=6294451

Note If additional issues occur or 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. To create a separate service request, visit the following Microsoft Web site:

http://support.microsoft.com/contactus/?ws=support

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.

Keywords: kbhotfixserver kbqfe kbprb kbqfe KB310711

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.