Hi,
I am trying to write a macro to load an XML file to memory and then walk through its various nodes and perform some actions. However, the XML documents that my macro is supposed to read contains a reference to an external DTD and each time when I run my code, I am getting the following error:
For some strange reason, Mr.Excels editor is removing the Src: content
The "task.dtd" file is available at another location ("C:\DITA\dtd\technicalContent\dtd").
Is there any way for me to ignore the DTD validation altogether? Or, can anyone suggest a way so that my code goes to the correct location to load the task.dtd file?
Here is the code I have written so far:
Thanks,
Raman
I am trying to write a macro to load an XML file to memory and then walk through its various nodes and perform some actions. However, the XML documents that my macro is supposed to read contains a reference to an external DTD and each time when I run my code, I am getting the following error:
Code:
D:\test.xml Invalid at the top level of the document.
Src: [QUOTE][/QUOTE]
For some strange reason, Mr.Excels editor is removing the Src: content
The "task.dtd" file is available at another location ("C:\DITA\dtd\technicalContent\dtd").
Is there any way for me to ignore the DTD validation altogether? Or, can anyone suggest a way so that my code goes to the correct location to load the task.dtd file?
Here is the code I have written so far:
Code:
Sub try1_not_in_use()Dim xmlDoc: Set xmlDoc = CreateObject("Microsoft.XMLDOM")
Dim xmlurl
For Each xmlurl In Array("D:\test.xml")
xmlDoc.async = False
xmlDoc.SetProperty "ProhibitDTD", True
If xmlDoc.Load(xmlurl) Then
With xmlDoc.DocumentElement.FirstChild
Debug.Print xmlurl _
, .tagName _
, .text
End With
Else
Debug.Print xmlurl, xmlDoc.parseError.reason, "Src:", xmlDoc.parseError.srcText
End If
Next
End Sub
Thanks,
Raman
Last edited: