欢迎光临

木子屋

标题: VB6.0读取XML示例

作者: dnawo

日期: 2009-09-28 11:56 AM

分类: Win编程

内容: 复制内容到剪贴板 程序代码Option Explicit
Private Sub Form_Load()
'需引用 Microsoft XML, v6.0
Dim xmlDoc As DOMDocument
Dim nodeList As IXMLDOMNodeList
Dim node As IXMLDOMNode

On Error Resume Next

Set xmlDoc = New DOMDocument
xmlDoc.loadXML ("<xml><website><domain>mzwu.com</domain><webmaster>dnawo</webmaster></website><website><domain>abc.com</domain><webmaster>abc</webmaster></website><website><domain>def.com</domain><webmaster>def</webmaster></website></xml>")
Set nodeList = xmlDoc.selectNodes("//website")
For Each node In nodeList
Text1.Text = Text1.Text & node.selectSingleNode("domain").Text & vbCrLf
Next

If Err.Number <> 0 Then
MsgBox Err.Description
End If

On Error GoTo 0
End Sub

+ 查看当前日志评论 (0)

登录

────────────

木子屋

PJBlog3 v3.2.9.518 Inside.

Processed In 2.180 ms

返回

标题: VB6.0读取XML示例

你没有权限发表评论

────────────

木子屋

PJBlog3 v3.2.9.518 Inside.

Processed In 2.180 ms

返回

暂无评论

返回

────────────

木子屋

PJBlog3 v3.2.9.518 Inside.

Processed In 2.242 ms

返回