能遍歷出乙個xml文件的所有的節點。
module module1
sub main()
dim ireturn as integer
dim myxmldocument as new xmldocument
myxmldocument.load("books.xml")
dim mynodes as xmlnode = myxmldocument.documentelement
listnode(mynodes)
myxmldocument = nothing
console.writeline("list over!")
end sub
sub listnode(byval onodes as xmlnode)
dim iattrib, inode, ichildnode as integer
if onodes.childnodes(0).name = "#text" then
console.writeline(onodes.name & "= " & onodes.innertext)
else
for iattrib = 0 to onodes.attributes.count - 1
console.writeline("attributes: " & onodes.attributes(iattrib).name & "= " & onodes.attributes(iattrib).value)
next
for inode = 0 to onodes.childnodes.count - 1
if onodes.childnodes.count >= 2 then
console.writeline("call listnode by self!")
listnode(onodes.childnodes(inode))
else
listnode(onodes.childnodes(0))
end if
next
end if
end sub
end module
Dom4j解析xml檔案 遞迴遍歷所有節點和屬性
張三24 男 李四24女 獲取檔案的document物件,然後獲取對應的根節點 author chenleixing test public void testgetroot throws exception 從指定節點開始,遞迴遍歷所有子節點 author chenleixing public v...
遞迴法(非遞迴法)遍歷二叉樹
2.4 用 遞迴法 非遞迴法 實現先序遍歷 中序遍歷和後序遍歷函式,要求遍歷時能執行一定的操作,且該操作可由遍歷函式的呼叫者來設定。define tree type int typedef struct tree nodetreenode 先序遍歷與建立二叉樹 遞迴法 include tree.h ...
ztree遍歷所有節點
ztree遍歷所有節點 var treeobj fn.ztree.getztreeobj tree var node treeobj.getnodes 可以獲取所有的父節點 var nodes treeobj.transformtoarray node 獲取樹所有節點 console.log nod...