日期:2012-12-01  浏览次数:20430 次

Dim domXmlDocument As System.Xml.XmlDocument
    Dim tmpPath As String = AppTempFilePath
    Dim xmlFile As String = tmpPath + "\testXml.xml" 

’窗体加载事件
    Private Sub TestXml_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        ’读xml过程测试通过
        Dim domXmlDocument As System.Xml.XmlDocument
        Dim tmpPath As String = AppTempFilePath
        Dim xmlFile As String = tmpPath + "\testXml.xml"
        Dim reader As System.Xml.XmlReader = Nothing
        Try
            reader = New Xml.XmlTextReader(xmlFile)
            ’reader.
            While reader.Read
                Me.lboxXml.Items.Add(reader.Name + reader.Value)
            End While
        Catch ex As Exception
            MsgBox(ex.Message)
        Finally
            If Not (reader Is Nothing) Then
                reader.Close()
            End If
        End Try
    End Sub
    ’载入xml事件
    Private Sub btnXmlLoad_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnXmlLoad.Click
        ’Me.lboxXml.Items.Clear()
        ’’读xml过程测试通过
        ’Dim reader As System.Xml.XmlReader = Nothing
        ’Try
        ’    reader = New Xml.XmlTextReader(xmlFile)
        ’    While reader.Read
        ’        Me.lboxXml.Items.Add(reader.Name + ":" + reader.Value)
        ’    End While
        ’Catch ex As Exception
        ’    MsgBox(ex.Message)
        ’Finally
        ’    If Not (reader Is Nothing) Then
        ’      &nb