I'm getting the error:
Line 49: xml = r.ReadToEnd(); Line 50: Line 51: System.Xml.Linq.XDocument xmlDoc = System.Xml.Linq.XDocument.Parse(xml); Line 52:
Line 53: var query = from p in xmlDoc.Descendants("member")
On my XML. When I run the code to generate the XML in an empty page, it runs without error, if I call the code within my webpage it throws this error. The only 'nbsp' on the page is a doctype declaration at the top of the XSLT:
<!DOCTYPE xsl:stylesheet [ <!ENTITY nbsp " "> ]>
I'm at a loss as to where this error is coming from and I am looking for suggestions please!
Thanks.
Here is the C# code that pulls in the XML:
protected void exportList(Object sender, EventArgs e)
{
String gid;
gid = Request.QueryString["gid"].ToString();
//XElement xml = XElement.Load("/members/listmembersxmlfeed?gid=" + gid);
String xml = String.Empty;
System.Net.WebResponse WR = System.Net.WebRequest.Create(Request.Url + "/members/listmembersxmlfeed?gid=" + gid).GetResponse();
System.IO.StreamReader r = new System.IO.StreamReader(WR.GetResponseStream());
xml = r.ReadToEnd();
System.Xml.Linq.XDocument xmlDoc = System.Xml.Linq.XDocument.Parse(xml);
var query = from p in xmlDoc.Descendants("member")
select new
{
Name = p.Element("name").Value,
Email = p.Element("email").Value
};
foreach (var member in query)
{
Response.Write("Employee: " + member.Name + " " + member.Email + "<br />");
}
}
Hope this help.