FIX: DTDs and Schemas Not Resolved When Using loadXML Method (235344)
The information in this article applies to:
- Microsoft Internet Explorer (Programming) 5
- Microsoft XML 2.0
This article was previously published under Q235344 SYMPTOMS
When you use the IXMLDOMDocument::loadXML method to load XML data into the MSXML parser via a string parameter, the MSXML parser does not correctly resolve any external files such as DTDs or Schemas.
Script in a Web page will not suffer from this bug because MSHTML, Internet Explorer's HTML engine, provides a valid security site object to the MSXML parser.
CAUSE
Due to a security constraint, resolveExternals is turned off while parsing the XML data loaded with loadXML.
RESOLUTION
The easiest workaround might be to call IXMLDOMDocument::load with a URL referencing an XML file. If loading from memory is preferred, there are three alternatives that will load XML Documents from memory sources and correctly resolve all external files:
- Attach a fake site object to the MSXML engine using the IObjectWithSite::SetSite method. See the C++ or Visual Basic examples in MORE INFORMATION below.
- Create a custom IStream wrapper over an in-memory buffer and pass it to MSXML's IPersistStream::Load or IXMLDOMDocument::load(VARIANT(IStream*)) methods. This is the most efficient mechanism for loading MSXML.
- Create an IStream over an HGLOBAL buffer using the CreateStreamOnHGlobal API and pass it to IPersistStream::Load or IXMLDOMDocument::load(VARIANT(IStream*)). This is less efficient than loadXML or the above technique, but is easier to code.
STATUSMicrosoft has confirmed that this is a bug in the Microsoft products that are listed at the beginning of this article.
This problem was corrected in MSXML 2.5.
Modification Type: | Major | Last Reviewed: | 10/16/2002 |
---|
Keywords: | kbBug kbDSupport kbMSXML250fix kbMSXMLnosweep KB235344 |
---|
|