0
votes

I have a series of functions already developed for working on xml files using MSXML2.DOMDocument60. However, when I try to load a html page using the code below I get an error saying

"DTD is not allowed"

. Does anyone know what I'm doing wrong?

Dim xml As MSXML2.DOMDocument60
Set xml = New MSXML2.DOMDocument60

If xml.Load(pathToHtml) Then
    Debug.Print "Success"
Else
    Debug.Print "Could not load the document: " & pathToHtml
    If xml.parseError.ErrorCode <> 0 Then Debug.Print "Error when loading was: " + xml.parseError.reason
End If

Thanks in advance for any advice,

John

1
Can you preprocess the doc and open the XML file, deleting the line that is referring to a DTD locationdbmitch
Any luck with trying the suggestion below?dbmitch
Can you provide enough xml/html to reproduce this?QHarr

1 Answers

0
votes

I think you can set the ValidateOnParse property to false - by default it is True.

This property is used to specify whether the XML parser should validate (true) this document against document type definition (DTD), schema, or schema cache on loading. This property is supported in MSXML 6.0.

Just before your line

If xml.Load(pathToHtml) Then

try adding the line:

xml.validateOnParse = False

More information on Microsoft's site