Vb操作XML例子

Dim xmlFile As Object
Dim xmlElement As Object
Dim xmlItem As Object

Set xmlFile = CreateObject("Microsoft.XMLDOM")
xmlFile.async = False
'xmlFile.Load "file.xml"
xmlFile.LoadXML "<item modifiedMark='2'><field name='aa'>1.5485</field><field name='bbb'>56880986</field><field name='ccc'>10</field><field name='ddd'>fdsaf</field></item>"

If xmlFile.documentElement Is Nothing Then xmlFile.loadXML "<item/>"

Dim i As Integer
Dim strText as String
Set xmlElement = xmlFile.documentElement.selectNodes("item/field")
For i = 1 To xmlElement.length
……
strText=xmlElement(i - 1).Text
……
Next i

你可能感兴趣的:(xml)