vb6.0 读取xml文件
答案:1 悬赏:40 手机版
解决时间 2021-04-01 20:17
- 提问者网友:心如荒岛囚我终老
- 2021-04-01 12:38
vb6.0 读取xml文件
最佳答案
- 五星知识达人网友:不甚了了
- 2021-04-01 14:05
xml文件名2.xml
我在遥望
月亮之上
在自由的飞翔
天上人间
自由自在
今天休息
--------------------------------------------------------
vb6.0原代码:Option Explicit
Dim XMLDoc As DOMDocument
Dim xList As IXMLDOMNodeList
Private Sub Form_Load()
Set XMLDoc = New DOMDocument
Dim n As Long
Dim i As Long
If XMLDoc.Load("\2.xml") Then
Set xList = XMLDoc.getElementsByTagName("test")
For i = 0 To xList.length - 1
Me.List1.AddItem xList.Item(i).Text
Next i
For n = 0 To xList.length - 1
For i = 0 To xList.Item(n).childNodes.length - 1
Me.List1.AddItem xList.Item(n).childNodes.Item(i).Text
Next i
Next n
End If
End Sub '----------放一个LIST控件
--------------------------------------------------------
vb6.0原代码:Option Explicit
Dim XMLDoc As DOMDocument
Dim xList As IXMLDOMNodeList
Private Sub Form_Load()
Set XMLDoc = New DOMDocument
Dim n As Long
Dim i As Long
If XMLDoc.Load("\2.xml") Then
Set xList = XMLDoc.getElementsByTagName("test")
For i = 0 To xList.length - 1
Me.List1.AddItem xList.Item(i).Text
Next i
For n = 0 To xList.length - 1
For i = 0 To xList.Item(n).childNodes.length - 1
Me.List1.AddItem xList.Item(n).childNodes.Item(i).Text
Next i
Next n
End If
End Sub '----------放一个LIST控件
我要举报
如以上回答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
点此我要举报以上问答信息
大家都在看
推荐资讯