I have a problem with streaming XML through ASPX
-
Hi, I have a problem with streaming XML. I have created an aspx which return me an xml file format (Type text/xml, Encoding.UTF8). Also now, I try to read this stream in the XmlTextReader but I receive an Error Message when I parse it. And of course, I don't understand that. Could you help me? It is a bit urgent.... Thanks a lot Code Source XmlTextReader XR = new XmlTextReader(Server.MapPath("GenerateXmlTreeView.aspx")); while(!XR.EOF){ XR.ReadElementString(); //Here Thrown exception } Sr.Close(); When I run may aspx 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: The '%' character, hexadecimal value 0x25, cannot begin a name. Line 1, position 2. Source Error: Source XML:
-
Hi, I have a problem with streaming XML. I have created an aspx which return me an xml file format (Type text/xml, Encoding.UTF8). Also now, I try to read this stream in the XmlTextReader but I receive an Error Message when I parse it. And of course, I don't understand that. Could you help me? It is a bit urgent.... Thanks a lot Code Source XmlTextReader XR = new XmlTextReader(Server.MapPath("GenerateXmlTreeView.aspx")); while(!XR.EOF){ XR.ReadElementString(); //Here Thrown exception } Sr.Close(); When I run may aspx 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: The '%' character, hexadecimal value 0x25, cannot begin a name. Line 1, position 2. Source Error: Source XML:
this wont work because you are reading the source for the apsx, i.e. you are getting back the
<% aspx stuff %>
you need to load the xml from using a uri, not from the file system
"When the only tool you have is a hammer, a sore thumb you will have."