本帖最后由 shqf 于 2012-3-16 19:42 编辑
今天终于搞懂了_MSXML_GetAttrib()的用法,可以获取元素的属性值了。楼主试试。;#include <_MSXML.au3>
#include <ACN_MSXML.au3>
#include <array.au3>
Local $oXMLDoc, $aName, $aValue
_MSXML_InitInstance($oXMLDoc)
If @error Then
MsgBox(0, "Error", "Failed to create instance")
Exit
EndIf
FileCopy(@ScriptDir & "\1.xml", @TempDir & "\1.xml", 1)
_MSXML_FileOpen($oXMLDoc, @TempDir & "\1.xml")
If @error Then
MsgBox(0, "Error", _MSXML_Error())
Else
$Nodes = _MSXML_GetChildNodes($oXMLDoc, "WIM")
For $i = 1 To $Nodes[0]
If $Nodes[$i] = "IMAGE" Then
$Value = _MSXML_GetAttrib($oXMLDoc, "WIM/" & $Nodes[$i] , "INDEX") ;获取元素的属性值
$text = _MSXML_GetChildText($oXMLDoc, "WIM/" & $Nodes[$i] & "/DISPLAYNAME")
MsgBox(0, "index=" & $Value, $text[1])
_MSXML_DeleteNode($oXMLDoc, "WIM/" & $Nodes[$i])
EndIf
Next
EndIf
$oXMLDoc = 0
|