关于读取listbox及listview写入XML文件的问题
本帖最后由 ashfinal 于 2009-10-21 23:01 编辑关于XML函数的资料似乎不多,UDF _XMLDomWrapper.au3也没有什么例子。自己硬着头皮看了两天,写出来的东西还是一运行就崩溃。前几天有事放下一段时间,现在一看代码就头大。厚着脸皮上来问问各位高手...
思路是这样的:listbox含有分组信息,listview(共5个)对应分组另有数据。想把数据读取到XML文件。
看起来就像这样:
以下是部分代码(整体代码几百行,贴不下),大家帮忙看看有什么问题:
_XMLFileOpen("XPlode.xml")
_XMLCreateChildNode("XPlode4", "items")
$listcount = _GUICtrlListBox_GetCount($List1)
For $i = 1 To $listcount
$title = _GUICtrlListBox_GetText($List1, $i - 1)
_XMLCreateChildWAttr("XPlode4/items", "item", "display", $title)
Select
Case $i = 1
$viewcount = _GUICtrlListView_GetItemCount($ListView2)
For $j = 1 To $viewcount
$split = StringSplit(_GUICtrlListView_GetItemTextString($ListView2, $j - 1), "|")
$subtitle = StringMid($split, StringInStr($split, "KB"), 8)
_XMLCreateChildWAttr("XPlode4/items/item", "execute", "display", "正在安装 " & $subtitle & " 请稍候...")
_XMLCreateChildNode("XPlode4/items/item/execute[" & $j & "]", "program", "#XPLODE#\soft\" & $split)
_XMLCreateChildNode("XPlode4/items/item/execute[" & $j & "]", "arguments", $split)
Next
Case $i = 2
$viewcount = _GUICtrlListView_GetItemCount($ListView3)
For $k = 1 To $viewcount
$split = StringSplit(_GUICtrlListView_GetItemTextString($ListView3, $k - 1), "|")
$subtitle = StringMid($split, StringInStr($split, "KB"), 8)
_XMLCreateChildWAttr("XPlode4/items/item", "execute", "display", "正在安装 " & $subtitle & " 请稍候...")
_XMLCreateChildNode("XPlode4/items/item/execute[" & $k & "]", "program", "#XPLODE#\soft\" & $split)
_XMLCreateChildNode("XPlode4/items/item/execute[" & $k & "]", "arguments", $split)
Next
Case $i = 3
$viewcount = _GUICtrlListView_GetItemCount($ListView4)
For $l = 1 To $viewcount
$split = StringSplit(_GUICtrlListView_GetItemTextString($ListView4, $l - 1), "|")
$subtitle = StringMid($split, StringInStr($split, "KB"), 8)
_XMLCreateChildWAttr("XPlode4/items/item", "execute", "display", "正在安装 " & $subtitle & " 请稍候...")
_XMLCreateChildNode("XPlode4/items/item/execute[" & $l & "]", "program", "#XPLODE#\soft\" & $split)
_XMLCreateChildNode("XPlode4/items/item/execute[" & $l & "]", "arguments", $split)
Next
Case $i = 4
$viewcount = _GUICtrlListView_GetItemCount($ListView5)
For $m = 1 To $viewcount
$split = StringSplit(_GUICtrlListView_GetItemTextString($ListView5, $m - 1), "|")
$subtitle = StringMid($split, StringInStr($split, "KB"), 8)
_XMLCreateChildWAttr("XPlode4/items/item", "execute", "display", "正在安装 " & $subtitle & " 请稍候...")
_XMLCreateChildNode("XPlode4/items/item/execute[" & $m & "]", "program", "#XPLODE#\soft\" & $split)
_XMLCreateChildNode("XPlode4/items/item/execute[" & $m & "]", "arguments", $split)
Next
Case $i = 5
$viewcount = _GUICtrlListView_GetItemCount($ListView6)
For $n= 1 To $viewcount
$split = StringSplit(_GUICtrlListView_GetItemTextString($ListView6, $n - 1), "|")
$subtitle = StringMid($split, StringInStr($split, "KB"), 8)
_XMLCreateChildWAttr("XPlode4/items/item", "execute", "display", "正在安装 " & $subtitle & " 请稍候...")
_XMLCreateChildNode("XPlode4/items/item/execute[" & $n & "]", "program", "#XPLODE#\soft\" & $split)
_XMLCreateChildNode("XPlode4/items/item/execute[" & $n & "]", "arguments", $split)
Next
EndSelect
Next 嗯,自己顶一下。貌似用到XML的时候挺多的,希望会有XML高手来指导一下。
不胜感激... :face (1): 对XML头疼,还是ini来的简单点 网页中肯定有不少地方用的是XML,学一点东西还是必要的。
原来向同学夸海口三天之内完成,就差这最后一得瑟了。
唉,卡这了... 继续期待高手。 这个函数在WINPE根本没有用。 5# 四海皆狂龙
没准备在PE中使用啊,只需要开机运行一次就可以了。
麻烦高手们帮忙看看吧。 如果哪位高手愿意帮忙的话,请把邮箱留下,我可以把全部源码发过去。 浏览人数这么多。嗯,往前推一下。:face (31): 给你顶下同求操作XML文件的方法 支持一下,希望高手出招 能不能用XMLDOM试试 顶,看看学习一下再说
页:
[1]