Results 1 to 3 of 3

Thread: Query multiple xml files

  1. #1

    Thread Starter
    New Member
    Join Date
    Jun 2009
    Posts
    3

    Query multiple xml files

    Hey guys, i am trying to query multiple xml files automatically in order to get a specific data for each xml files. I have create a code but it only query one file at the time. Below is the code that i have created.


    Imports System.Xml
    Imports System.IO
    Module ParsingUsingXmlTextReader


    Sub Main()
    Dim m_xmlr As XmlTextReader
    m_xmlr = New XmlTextReader("C:\Testing\schaumburg_5min_cpu_143.xml")
    m_xmlr.WhiteSpaceHandling = WhiteSpaceHandling.NONE
    m_xmlr.Read()
    m_xmlr.Read()
    While Not m_xmlr.EOF
    m_xmlr.Read()
    If Not m_xmlr.IsStartElement() Then
    Exit While
    End If

    Dim lastvalue = m_xmlr.ReadElementString("value")
    Dim primary_value = m_xmlr.ReadElementString("primary_value")
    Console.WriteLine(" primary_value: " & primary_value & " value: " _
    & lastvalue)
    Console.Write(vbCrLf)
    End While
    m_xmlr.Close()


    End Sub

    End Module

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: Query multiple xml files

    Put your code into a method (Sub or Function) that has a parameter for the file path. You can then call that method multiple times and pass a different file path each time.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  3. #3

    Thread Starter
    New Member
    Join Date
    Jun 2009
    Posts
    3

    Re: Query multiple xml files

    Can you be more specific please? If you dont mind, can you give me an example as you know i am a newbie. lol

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width