|
1、
Set doc = XMLUtil.CreateXML()
doc.LoadFile "c:\example.xml"
Set root = doc.GetRootElement()
Set children = root.ChildElements()
Set child = children.ItemByName("Cartman")
numOfChildren = 0
While Not child Is nothing
numOfChildren = numOfChildren+1
Set child = children.ItemByName("Cartman",numOfChildren+1)
Wend
msgbox "The number of children named Cartman is " & numOfChildren
2、
Set doc = XMLUtil.CreateXML()
doc.LoadFile "c:\example.xml"
Set root = doc.GetRootElement()
Set attribs = root.Attributes()
numOfAttr = attribs.Count()
i = 1
While i <= numOfAttr
Set attr = attribs.Item(i)
nameStr = attr.Name()
valStr = attr.Value()
attrStr = attrStr + nameStr+"="+chr(34)+valStr+chr(34) + " "
i = i+1
Wend
msgbox "Attributes: " + attrStr
小弟想知道以上2段代码都实现了什么功能啊,请各位给小弟一点指导。
小弟先此谢谢了 |
|