Microsoft KB Archive/254643: Difference between revisions

From BetaArchive Wiki
m (Text replacement - "&" to "&")
m (Text replacement - """ to """)
 
Line 52: Line 52:
<div class="errormessage">
<div class="errormessage">


&quot;System error: -2146697210. Error processing resource 'xxx.DTD'&quot;
"System error: -2146697210. Error processing resource 'xxx.DTD'"


</div>
</div>
Line 75: Line 75:
== MORE INFORMATION ==
== MORE INFORMATION ==


Internet Explorer 5.01 fixes another problem with similar symptoms in which DTDs and schemas are not resolved when you use the '''loadXML''' method. See the &quot;References&quot; section for additional information on that problem.<br />
Internet Explorer 5.01 fixes another problem with similar symptoms in which DTDs and schemas are not resolved when you use the '''loadXML''' method. See the "References" section for additional information on that problem.<br />
<br />
<br />
After you install Internet Explorer 5.01, you can use '''loadXML''' with DTDs or schemas in a client-side script without problem. However, you will still experience the problem when you use a relative path on the server side.<br />
After you install Internet Explorer 5.01, you can use '''loadXML''' with DTDs or schemas in a client-side script without problem. However, you will still experience the problem when you use a relative path on the server side.<br />
Line 104: Line 104:
   Dim dtdpath
   Dim dtdpath


   Set oXML =  Server.CreateObject(&quot;MSXML.DOMDocument&quot;)
   Set oXML =  Server.CreateObject("MSXML.DOMDocument")


To use version 4 of the MSXML parser, for example, change the CreateObject statement to:
To use version 4 of the MSXML parser, for example, change the CreateObject statement to:
Set oXML =  Server.CreateObject(&quot;MSXML2.DOMDocument.4.0&quot;)
Set oXML =  Server.CreateObject("MSXML2.DOMDocument.4.0")


   oXML.async = false
   oXML.async = false
Line 114: Line 114:


   'This WILL NOT work.
   'This WILL NOT work.
   strXML = &quot;<?xml version='1.0'?> &quot; & _
   strXML = "<?xml version='1.0'?> " & _
             &quot;<!DOCTYPE Root SYSTEM 'REPRO.DTD'>&quot; & _
             "<!DOCTYPE Root SYSTEM 'REPRO.DTD'>" & _
             &quot;<Root><Data> some data</Data></Root>&quot;
             "<Root><Data> some data</Data></Root>"


   'This WILL work.
   'This WILL work.
   'dtdpath = Server.MapPath(&quot;REPRO.DTD&quot;)
   'dtdpath = Server.MapPath("REPRO.DTD")
   'strXML = &quot;<?xml version='1.0'?> &quot; & _
   'strXML = "<?xml version='1.0'?> " & _
   '          &quot;<!DOCTYPE Root SYSTEM '&quot; & dtdpath & &quot;'>&quot; & _
   '          "<!DOCTYPE Root SYSTEM '" & dtdpath & "'>" & _
   '          &quot;<Root><Data>Got the data</Data></Root>&quot;
   '          "<Root><Data>Got the data</Data></Root>"


   If not oXML.loadXML(strXML) Then
   If not oXML.loadXML(strXML) Then

Latest revision as of 13:52, 21 July 2020

Article ID: 254643

Article Last Modified on 8/14/2007



APPLIES TO

  • Microsoft Internet Explorer 5.0
  • Microsoft Internet Explorer 5.01
  • Microsoft XML Parser 2.5
  • Microsoft XML Parser 2.6
  • Microsoft XML Parser 3.0
  • Microsoft XML Core Services 4.0



This article was previously published under Q254643

SYMPTOMS

When you use the loadXML method to load an XML string that references an external document type definition (DTD) or schema on the server side in an Active Server Pages (ASP) page, the following error message may appear:

"System error: -2146697210. Error processing resource 'xxx.DTD'"

CAUSE

The Microsoft XML parser (MSXML) cannot determine the physical location of the file from a relative path.

RESOLUTION

To resolve this problem, use an absolute path instead of a relative path. You can use either a full Universal Naming Convention (UNC) path or a file path. You can use the MapPath method of the server object to map a specified relative or virtual path to the corresponding physical folder on the server.

MORE INFORMATION

Internet Explorer 5.01 fixes another problem with similar symptoms in which DTDs and schemas are not resolved when you use the loadXML method. See the "References" section for additional information on that problem.

After you install Internet Explorer 5.01, you can use loadXML with DTDs or schemas in a client-side script without problem. However, you will still experience the problem when you use a relative path on the server side.

The loadXML method merely takes a string of XML into memory. When this string has a reference to an external DTD or schema, MSXML attempts to load the file. If the path is a relative path, MSXML has no way to locate the file and fails to process the DTD or schema.
If a newer version of MSXML has been installed in side-by-side mode, you must explicitly use the Globally Unique Identifiers (GUIDs) or ProgIDs for that version to run the sample code. For example, MSXML version 4.0 can only be installed in side-by-side mode. For additional information about the code changes that are required to run the sample code with the MSXML 4.0 parser, click the following article number to view the article in the Microsoft Knowledge Base:

305019 INFO: MSXML 4.0 Specific GUIDs and ProgIds


Steps to Reproduce Behavior

  1. Create a file named Repro.dtd and paste the following code:

    <!ELEMENT Root (Data)>
    <!ELEMENT Data (#PCDATA)>
                        
  2. Create an ASP page named Repro.asp and paste the following code:

    <%@ Language=VBScript %>
    <HTML>
    <HEAD></HEAD>
    <BODY>
    <% 
      Dim oXML
      Dim strXML
      Dim dtdpath
    
      Set oXML =  Server.CreateObject("MSXML.DOMDocument")
    
    To use version 4 of the MSXML parser, for example, change the CreateObject statement to:
    Set oXML =  Server.CreateObject("MSXML2.DOMDocument.4.0")
    
      oXML.async = false
      oXML.resolveExternals = True
      oXML.validateOnParse = True
    
      'This WILL NOT work.
      strXML = "<?xml version='1.0'?> " & _
                 "<!DOCTYPE Root SYSTEM 'REPRO.DTD'>" & _
                 "<Root><Data> some data</Data></Root>"
    
      'This WILL work.
      'dtdpath = Server.MapPath("REPRO.DTD")
      'strXML = "<?xml version='1.0'?> " & _
      '           "<!DOCTYPE Root SYSTEM '" & dtdpath & "'>" & _
      '           "<Root><Data>Got the data</Data></Root>"
    
      If not oXML.loadXML(strXML) Then
         Response.write oXML.parseError.reason 
      Else
         Response.Write oXML.XML
      End If
    %>
    
    </BODY>
    </HTML>
                        
  3. Deploy both files to your Web server.
  4. In Internet Explorer, browse to Repro.asp. Either the data or an error is displayed.


REFERENCES

For more information about developing Web-based solutions for Microsoft Internet Explorer, visit the following Microsoft Web sites:

Platform SDK, Server.MapPath

For additional information237906, click the article numberPRB: Loading Remote XML or Sending XML HTTP Requests from Server Is Not Supported below to view the articlePRB: Loading Remote XML or Sending XML HTTP Requests from Server Is Not Supported in the Microsoft Knowledge Base:

%3 %4


%1 %2



Additional query words: script DOCTYPE

Keywords: kbprb kbsbnworkshop KB254643