本帖最后由 newx 于 2009-10-12 20:41 编辑
给个事例,不知是不是这意思,至于XML文件中的节点是怎样的,自己参考后改一下(其实在AU3的英文官方论坛上有很多事例可作参考的:
XML.xml<news>
<item>
<title>1111</title>
<text>111111111111</text>
</item>
<item>
<title>222222</title>
<text>222222222222</text>
</item>
</news>
GUI#include <GUIConstantsEx.au3>
#include <ListViewConstants.au3>
#include <WindowsConstants.au3>
#include <_XMLDomWrapper.au3>
#include <GUIListView.au3>
#Region ### START Koda GUI section ### Form=
Local $msg
$Form1 = GUICreate("Form1", 595, 267, 196, 124)
$nTEMP = "XML.xml" ;可以是http://新浪的XML文件地址
_XMLFileOpen($nTEMP) ;打开XML文件
$ListView1 = GUICtrlCreateListView(" |新闻标题|新闻内容", 32, 32, 529, 201)
$ntitle = _XMLGetValue("/news/item/title")
$ntext = _XMLGetValue("/news/item/text")
Local $MyClick[UBound($ntitle)]
For $k = 1 To UBound($ntitle)-1
$MyClick[$k] = GUICtrlCreateListViewItem($k&"|"&$ntitle[$k]&"|"&$ntext[$k], $ListView1)
Next
GUISetState(@SW_SHOW)
GUISetState(@SW_SHOW)
While True
$MSG = GUIGetMsg()
Switch $MSG
Case $GUI_EVENT_CLOSE
Exit
EndSwitch
For $k = 1 To _GUICtrlListView_GetItemCount($ListView1)
If $MSG = $MyClick[$k] Then
$uTemp = StringSplit(GUICtrlRead(GUICtrlRead($ListView1)),"|")
$utitle = $uTemp[2]
$utext = $uTemp[3]
msgbox(0,0,"新闻标题:" & $utitle & @CRLF & "新闻内容:" & $utext & @CRLF)
EndIf
Next
WEnd
|