How to query multiple xml files?

xml , java , c , vb , asp.net Detroit, United States
  • 11 years 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 a reply

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

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

Contribute

Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“Owning a computer without programming is like having a kitchen and using only the microwave oven” - Charles Petzold