Read xml file

works most of the time

Page 1 of 1

3 Replies - 3810 Views - Last Post: 04 July 2010 - 04:41 PM Rate Topic: -----

#1 deery5000  Icon User is offline

  • D.I.C Addict

Reputation: 78
  • View blog
  • Posts: 969
  • Joined: 09-May 09

Read xml file

Posted 04 July 2010 - 03:44 PM

Hi guys

im parsing an xml file using this code

 Private Function overview2(ByRef filePath As String)

        Dim reader As XmlTextReader = New XmlTextReader(filePath + "\movieData.xml")
      
        reader.WhitespaceHandling = WhitespaceHandling.None

        Dim i As Integer = 0
        reader.Read()
        While Not reader.EOF()

            reader.Read()
            If reader.Name = "overview" Then
                reader.Read()
                overview2TextBox.Text = reader.Value
                Exit While
            End If
            reader.Read()

        End While

        reader.Close()

        Return 0
    End Function



it works 80% of the time. What i mean is , i go through each node and when i find the overview node i read the data and
send it to a text box. Im doing this for movies on disk. sometimes on certain movies it doesnt find the overview node even though it is there

could someone have a glance and see if theres something im missing that maybe causing this

Thanks
Kevin

Is This A Good Question/Topic? 0
  • +

Replies To: Read xml file

#2 AdamSpeight2008  Icon User is offline

  • MrCupOfT
  • member icon


Reputation: 2263
  • View blog
  • Posts: 9,467
  • Joined: 29-May 08

Re: Read xml file

Posted 04 July 2010 - 03:51 PM

Have a look at using the XML Literals syntax instead.
Was This Post Helpful? 0
  • +
  • -

#3 deery5000  Icon User is offline

  • D.I.C Addict

Reputation: 78
  • View blog
  • Posts: 969
  • Joined: 09-May 09

Re: Read xml file

Posted 04 July 2010 - 04:04 PM

i used my way throughout my project.

Im not looking to change my method completly but to add a solution to my problem. any other tips?
Was This Post Helpful? 0
  • +
  • -

#4 deery5000  Icon User is offline

  • D.I.C Addict

Reputation: 78
  • View blog
  • Posts: 969
  • Joined: 09-May 09

Re: Read xml file

Posted 04 July 2010 - 04:41 PM

Solved

I was double reading :) just removed one of reader.value

Thanks for the responses
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1