0
Answer

Reading XML online using vb.net

sumeetsoni

sumeetsoni

20y
2k
1
Hi, I am trying to read an XML file online thru the following code: Dim m_xmlr As XmlTextReader 'Create the XML Reader m_xmlr = New XmlTextReader("http://www.sportspunter.com/xml?username=&password=&cid=1&markets=") 'Handle whitespaces m_xmlr.WhitespaceHandling = WhitespaceHandling.None 'Read the xml declaration m_xmlr.Read() Using the above code i recieve the following error : Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.Xml.XmlException: This is an unexpected XML declaration. Line 1, position 5. Source Error: Line 45: m_xmlr.Read() Stack Trace: [XmlException: This is an unexpected XML declaration. Line 1, position 5.] System.Xml.XmlTextReader.ParseTag() +2447 System.Xml.XmlTextReader.ParseRoot() +234 System.Xml.XmlTextReader.Read() +127 test1.WebForm1.parse() in c:\inetpub\wwwroot\test1\WebForm1.aspx.vb:45 test1.WebForm1.Page_Load(Object sender, EventArgs e) in c:\inetpub\wwwroot\test1\WebForm1.aspx.vb:27 System.Web.UI.Control.OnLoad(EventArgs e) System.Web.UI.Control.LoadRecursive() System.Web.UI.Page.ProcessRequestMain() The first line of the XML file is: Looking for a solution urgently Thanx in advance :) Sumeet Soni