|
很简单,我写一段遍历xml的代码给你参考下:
'==========================================================================
' NAME: XMLread
'
' AUTHOR: songfun , 51Testing
' DATE : 2007-4-28
'
' COMMENT:
'
'==========================================================================
Option Explicit
Dim xmlDoc,myErr,strXML
Set xmlDoc = CreateObject("Microsoft.XMLDOM")
xmlDoc.async = False
xmlDoc.load "c:\calc1.xml"
If xmlDoc.parseError.errorCode <> 0 Then
Set myErr = xmlDoc.parseError
MsgBox("XML Loads Failed. " & myErr.reason)
Else
Set rootNode = xmlDoc.documentElement
Call rTravel(rootNode)
MsgBox strXML
End If
Sub rTravel (rNode)
Dim blnTwo,intTestCase,
blnTwo = False
iLen = rNode.childNodes.length
If iLen > 0 Then
For i = 0 To rNode.childNodes.length -1
Set child = rNode.childNodes.item(i)
Call rTravel(child)
childtext = child.nodeValue
strXML = strXML & childtext & chr(13)
Next
Else
Exit Sub
End If
End Sub |
|