Program skips code after trying to parse XML in VB.NET

Posted by Bead on Stack Overflow See other posts from Stack Overflow or by Bead
Published on 2010-06-08T03:15:39Z Indexed on 2010/06/08 3:22 UTC
Read the original article Hit count: 337

Filed under:
|

I'm trying to parse some XML (html) I downloaded using WebRequest.Create() and then read it. However after loading the XML file using LoadXml(string), anything else I execute doesn't work. Setting a breakpoint on anything afterwards doesn't work and it doesn't break.

I tried catching exception but none are occurring, so I'm not sure what the problem is.

Here is my code:

Dim reader As StreamReader = New StreamReader(HTTPResponse.GetResponseStream())
        Dim xDoc As XmlDocument = New XmlDocument()
        xDoc.LoadXml(reader.ReadToEnd())
        Dim omfg As String = xDoc.ChildNodes().Item(0).InnerText()
        Dim name As XmlNodeList = xDoc.GetElementsByTagName("div")
        Dim jj As Integer = name.Count
        For i As Integer = 0 To name.Count - 1
            MessageBox.Show(name.Item(i).InnerText)
        Next i

Anything after the "xDoc.LoadXml(reader.ReadToEnd())" doesn't execute.. Any ideas on this? My XML does have some whitespace at the beginning, I don't know if that is causing the problem...

© Stack Overflow or respective owner

Related posts about Xml

Related posts about vb.net