在Visual Basic 6.0中操纵XML文件
来源:互联网
作者:西部数码
时间:2008-04-09
西部数码-全国虚拟主机10强!40余项虚拟主机管理功能,全国领先!双线多线虚拟主机南北访问畅通无阻!免费赠送企业邮局,.CN域名,自助建站480元起,免费试用7天,满意再付款! P4主机租用799元/月.月付免压金!
CreateNode 4, values_node, "Zip", txtZip.Text
' Save the XML document.
xml_document.save m_AppPath & "Values.xml"
End Sub
' Add a new node to the indicated parent node.
Private Sub CreateNode(ByVal indent As Integer, _
ByVal parent As IXMLDOMNode, ByVal node_name As String, _
ByVal node_value As String)
Dim new_node As IXMLDOMNode
' Indent.
parent.appendChild _
parent.ownerDocument.createTextNode(Space$(indent))
' Create the new node.
Set new_node = parent.ownerDocument.createElement(node_name)
' Set the node's text value.
new_node.Text = node_value
' Add the node to the parent.
parent.appendChild new_node
' Add a new line.
parent.appendChild parent.ownerDocument.createTextNode(vbCrLf)
End Sub
结论
本文仅仅揭示XML编程的表面,本文的例子中的涉及只是非常简单的XML文件,但你可以使用使用本文揭示的技术做更多的事情,比如配置设置、表单位置、以及其他信息。XML已经向前更进一步的发展了,有了更复杂的数据层次。对于更复杂的数据结构,在运行时可以更容易的使用MSXML对象来存取XML文件
文章整理:西部数码--专业提供域名注册、虚拟主机服务
http://www.west263.com
以上信息与文章正文是不可分割的一部分,如果您要转载本文章,请保留以上信息,谢谢!



