Click to See Complete Forum and Search --> : xml parsing


Funkymonkey
10-27-2005, 08:55 AM
I'm trying to read the xml in my aspx page but it wont work :( Can anyone shed some light?

Thanks

Sub main()

'Page_Load(ByVal sender As System.Object, ByVal e As Exception) Handles MyBase.Load
Dim m_xmlr As XmlTextReader
'Create the XML Reader
m_xmlr = New XmlTextReader("c:\\inetpub\wwwroot\Info\Home.aspx")
'Disable whitespace so that you don't have to read over whitespaces
m_xmlr.WhitespaceHandling = WhitespaceHandling.None
'read the xml declaration and advance to base tag
m_xmlr.Read()
'read the base tag - propstat
m_xmlr.Read()
'Load the Loop
While Not m_xmlr.EOF
'Go to the second tag - prop
m_xmlr.Read()
'if not start element exit while loop
If Not m_xmlr.IsStartElement() Then
Exit While
End If
'Read elements subject
m_xmlr.Read()
'Get the subject Element Value
Dim subject = m_xmlr.ReadElementString("subject")
'Write Result to the Console
Label1.Text = "Subject: " & subject
End While
'close the reader
m_xmlr.Close()
End Sub