Community discussion forum

How to query multiple xml files?

  • 5 months ago

    Hello guys, i want to query multiple xml files to get a specific result for each xml file.

    Imports System.IO Imports System.Xml

    Module ParsingUsingXmlDocument

    Sub Main()
        Try
            Dim m_xmld As XmlDocument
            Dim m_nodelist As XmlNodeList
            Dim m_node As XmlNode
            m_xmld = New XmlDocument()
            m_xmld.Load("C:/Testing/schaumburg_5min_cpu_143.xml")
            m_nodelist = m_xmld.SelectNodes("//*")
            For Each m_node In m_nodelist
                If m_node.Name = "ds" Then
                    Dim m_node2 As XmlNode
                    m_node2 = m_node.SelectSingleNode("./primary_value")
                    Console.WriteLine(m_node2.InnerXml)
                End If
                '        Dim primary_value = m_node.ChildNodes.Item(0).InnerText
                '        Dim value_Value = m_node.ChildNodes.Item(1).InnerText
                '        Console.Write(" primary_value: " & primary_value & " value_Value: " _
                '& value_Value)
                '        Console.Write(vbCrLf)
            Next
        Catch errorVariable As Exception
    
            Console.Write(errorVariable.ToString())
        End Try
    End Sub
    

    End Module

    Post was edited on 03/06/2009 20:14:31 Report abuse

Post a reply

No one has replied yet! Why not be the first?

Sign in or Join us (it's free).

We'd love to hear what you think! Submit ideas or give us feedback