PRB: No Access XML Object Model After Call to XML Parser Load() MethodID: Q221841
|
The load() method returns successfully but errors occur when accessing the MSXML Document Object Model. The XML document is valid, well-formed, and it contains no errors.
This behavior may be intermittent and does not occur when loading the XML document from the local file system (file://).
By default, the XML parser loads and parses an XML file asynchronously over HTTP. This means that portions of the document's object model will not be available to code immediately after load returns.
To ensure the document is loaded, either:
Here is an example fragment of VBScript that uses the async property:
Set xmlDoc = CreateObject("Microsoft.XMLDOM")
xmlDoc.async = false
xmlDoc.load strURLofXMLDoc
Here is the equivalent solution in a Visual C++ host:
MSXML::IXMLDOMDocumentPtr pDOMDoc(__uuidof(MSXML::DOMDocument));
pDOMDoc->put_async(VARIANT_FALSE);
VARIANT_BOOL varResult = DOMDoc->load(_variant_t(bstrURLofXMLDoc));
For additional information about the asynchronous behavior of the Internet Explorer 5.0 XML parser, please see the following article in the Microsoft Knowledge Base:
Q223337 Loading/saving XML data using the Internet Explorer XML parser
http://msdn.microsoft.com/workshop/default.asp
Additional query words: load IXMLDOMDocument
Keywords : kbGrpInet kbIE500 kbXML kbDSupport
Version : WINDOWS:5.0
Platform : WINDOWS
Issue type : kbprb
Last Reviewed: July 27, 1999