I have the following code. When I run the code I get an error saying that it cannot create the IXMLDOMNODE.
Any ideas. I have this working in VB6 and was trying to convert to VBScript as I need to run it on an ASP page.
Thanks.
Swi
Any ideas. I have this working in VB6 and was trying to convert to VBScript as I need to run it on an ASP page.
Thanks.
Code:
Dim xDoc, fso, f1
Set fso = CreateObject("Scripting.FileSystemObject")
Set xDoc = CreateObject("MSXML2.DOMDocument.6.0")
Set f1 = fso.OpenTextFile("C:\12484.txt",2,True)
xDoc.validateOnParse = False
xDoc.Load "C:\12484.cxml"
DisplayNode xDoc.childNodes, 0
f1.Close
Set fso = Nothing
Set f1 = Nothing
Set xDoc = Nothing
MsgBox "Done!"
Sub DisplayNode(Nodes, Indent)
Dim xNode
Set xNode = CreateObject("MSXML2.IXMLDOMNode")
Indent = Indent + 2
For Each xNode In Nodes
If xNode.nodeType = NODE_TEXT Then
MSgbox Space(Indent) & xNode.parentNode.nodeName & ":" & xNode.nodeValue
End If
If xNode.hasChildNodes Then
DisplayNode xNode.childNodes, Indent
End If
Next
End Sub
Swi