FIX: Enumerating Collection of Nodes May Fail Silently on Second Iteration (310711)
The information in this article applies to:
- Microsoft XML 2.6
- Microsoft XML 3.0
- Microsoft XML 3.0 SP1
- Microsoft XML 3.0 SP2
- Microsoft XML 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.
RESOLUTIONA supported hotfix is now available from Microsoft, but it is only intended to correct the problem that is described in this article. Only apply it to systems that are experiencing this specific problem. This hotfix may receive additional testing. Therefore, if you are not severely affected by this problem, we recommend that you wait for the next MSXML service pack that contains this hotfix. To resolve this problem immediately, contact Microsoft Product Support Services to obtain the fix. For a complete list of Microsoft Product Support Services phone numbers and information about support costs, visit the following Microsoft Web site: NOTE: In special cases, charges that are ordinarily incurred for support calls may be canceled if a Microsoft Support Professional determines that a specific update will resolve your problem. The typical support costs will apply to additional support questions and issues that do not qualify for the specific update in question. 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).
STATUSMicrosoft has confirmed that this is a problem in the Microsoft products that are listed at the beginning of this article.
Modification Type: | Minor | Last Reviewed: | 10/12/2005 |
---|
Keywords: | kbHotfixServer kbQFE kbprb kbQFE KB310711 |
---|
|