vb.net读取多层xml文件代码
来源:互联网 发布:加工中心钻孔循环编程 编辑:程序博客网 时间:2024/04/26 23:53
Public Sub GetModuleDataFromXml()
Dim reader As New XmlTextReader(DataFilename)
'move to the strat of the document
reader.MoveToContent()
'start working through the document
Dim addressData As Collection = Nothing
Dim elementName As String = Nothing
Try
Do While reader.Read
'what kind of node to we have?
Select Case reader.NodeType
'is it the start of an element
Case XmlNodeType.Element
'if it's an element start,is it "Address"
If reader.Name = "Car" Then
'if so,create a new collection..
addressData = New Collection()
Else
'if not ,record the name of the collection
elementName = reader.Name
End If
'if we have some text,try storing it in the collection...
Case XmlNodeType.Text
'do we have an address?
If Not addressData Is Nothing Then
addressData.Add(reader.Value, elementName)
End If
Case XmlNodeType.EndElement
'if it is, we should have an entire address stored...
If reader.Name = "Car" Then
Try
With Me
.Label1.Text = addressData("label1")
.Label2.Text = addressData("label2")
.Label3.Text = addressData("label3")
.Label4.Text = addressData("label4")
.Label5.Text = addressData("label5")
End With
'With carTest
' .strCarStyle = addressData("firstname")
' .strEngine = addressData("lastname")
' .intCareer = addressData("address1")
' .strRefrigerationStyle = addressData("address2")
' .intCylinderNum = addressData("region")
'End With
'carTest()
'carTest()
'item = addressData("firstname") & " " & addressData("lastname")
'item &= "(" & addressData("email") & ")"
Catch ex As Exception
End Try
'reset...
addressData = Nothing
End If
End Select
Loop
Catch ex As Exception
MessageBox.Show(ex.Message)
Finally
If (reader IsNot Nothing) Then
reader.Close()
End If
End Try
End Sub
- vb.net读取多层xml文件代码
- VB.NET读取 XML文件
- vb.net读取任意xml文件
- 使用vb.net读取xml文件
- VB.NET 读取写入XML文件
- VB.NET 读取写入XML文件
- vb 读取xml文件
- VB读取XML文件
- VB.NET读取文件
- Java读取多层级xml文件
- Java读取多层级xml文件
- vb.net读取xml文件中的节点内容
- 如何用VB.net快速读取较大的xml文件
- VB.NET 从XML文件中读取内容到JSON
- [VB.NET]vb.net如何读取数据库生成指定格式的xml文件
- vb.net 读取ini文件
- .net读取xml文件
- VB.NET 读写XML文件
- UTF-8
- 获取远程网卡MAC地址(VC++)
- log4j使用
- 澄清概念:委托---事件---事件处理
- Windows下DNS ID欺骗的原理与实现
- vb.net读取多层xml文件代码
- DirectShow开发代码
- COM技术初探(三)-- 一个真正的COM
- Kaixin、kaxin000、kaixin001到底谁开心?
- 类似MSN弹出框的JavaScript代码
- com技术初探(二)续
- Firefox 键盘快捷键
- COM技术初探(二)
- VS2005(c#)项目调试问题解决方案集锦