Asked by:
What causes this? XML Parsing Error: no element found

Question
-
User-647359487 posted
Nothing has changed on the server and the same virtual directory has been working fine for months. All other pages that I'll test will work fine, but I'll come across a page or two that will give this very helpful error.
I've had this happen when something wasn't 'just right' with my database or something else wasn't right, but it's not ever something that's super obvious.
Does anyone have any ideas on how to get a useful error message that might actually help in debugging the issue.
I did actually track down the issue - a referenced UserControl had changed locations in the web.config, but the 'live' web.config hadn't been updated (good thing I had added some logging to the application).
Thanks for any suggestions!
Friday, June 30, 2006 10:48 AM
All replies
-
User-1853252149 posted
You found the best method to track these down already -- Adding logging to the application. 90% of development is trapping and dealing with errors.
Jeff
Friday, June 30, 2006 11:19 AM -
User-647359487 posted
I was hopeful that there would be a way to catch these types of errors during development as I've only been encountering them once moving applications to another environment, but I agree about your statement about trapping and dealing.
Friday, June 30, 2006 11:59 AM -
User-670356834 posted
I'm currently being frustrated by the same error - here's my story.
I'm writing an ISAPI to reroute XML file requests (from a SWF) to a different directory/file. I got the implmentation running perfectly on my dev box (WinXP Pro) and am trying to deploy it to a machine running Windows Server 2003 - and I get the above error whenever I ask IIS for an XML file. If I remove my ISAPI mapping the .XML extension it serves up the XML files fine.
So - why does mapping the .xml extension to the ASP.NET dll screw up the way IIS serves up XML files?
M@Tuesday, August 1, 2006 3:16 PM -
User-1853252149 posted
Possibly a permission error. Your development system is running as the logged in user, your web server is running under the anonymous user or ASP.NET process account.
Jeff
Tuesday, August 1, 2006 3:32 PM -
User-670356834 posted
I figured a little bit out - turns out the error is a FireFox error when it gets an empty document and is expecting XML.
Our problem turns out to be an HttpHandler redirect loop cuasing the empty document to be returned.
So, once again, no solution, but I understand the problem.
M@Wednesday, August 2, 2006 1:41 PM -
User1900948409 posted
i had it happen today on my machine as well. i believe it's a firefox caching issue. but the underlying problem is that the page is not rendering anything. in my case i opened up internet explorer (yuk) and it turns out my webserver wasn't even running.
i opened up IIS and sure enough, the web server had stopped. i tried starting it and got this error: "Unexpected Error 0x8ffe2740"
turns out that error means IIS can't start because the port that it's trying to use is already bound to something. in this case, i run trillian (an instant messaging client) and the little bugger had grabbed port 80.
here's a little article on it: http://geekswithblogs.net/lorint/archive/2005/12/12/62910.aspx
-b
Wednesday, August 2, 2006 10:52 PM -
User128051861 posted
I encountered the same problem while customizing the Application_Error method of the Global.asax file. It would alert me via e-mail that an error ocurred, but it would render the same error above.
A simple re-direct solved the problem.
void Application_Error(object sender, EventArgs e)
{
HttpContext ctx = HttpContext.Current;
Exception exception = ctx.Server.GetLastError();
string errorInfo =
"<br>Offending URL: " + ctx.Request.Url.ToString() +
"<br>Source: " + exception.Source +
"<br>Message: " + exception.Message +
"<br>Stack trace: " + exception.StackTrace;
Email email = new Email(
"email@to.com",
"The Name"
errorInfo,
"Unhandled Exception Ocurred",
"server");
email.Send();
ctx.Server.ClearError();
Response.Redirect("~/errors/ServerError.aspx");
}Wednesday, August 9, 2006 6:12 PM -
User520095576 posted
Hi All,
While uploading an image i will get below mention error.
"
XML Parsing Error: no element found
Location: http://www.tooeasy.com.au/ImageUpload.aspx?PortalID=0&TaskID=-1&UserID=4&DJUploadSessionID=a650c055-76b1-44ae-80a4-84ab06cd38fe
Line Number 1, Column 1:"Can any one help me out from this error.
Regards
sarita
Tuesday, September 16, 2008 5:19 AM -
User755149609 posted
Hi,
Ive been strcuk with the same error for sooo many days.My localhost seems to be working, while the files i saved in the network doesnt work.Finally found a solution for it.Infact i was working with c#.And just put Application_error tag in Global.asax
<script runat="server">
protected void Application_Error(object sender, EventArgs e)
{
}
</script>
No need to add any error handling code inside.Just leave it blank.It works perfectly fine for me.And the problem is solved.And errors started showing in the web page.
Regards,
Thas....
Thursday, October 30, 2008 4:59 AM -
User-392871504 posted
There can be two reasons for this. One you may have one or more unclosed HTML tags. Two you may have not set proper content type for response. Read http://chiragrdarji.wordpress.com/2010/02/17/xml-parsing-error-no-element-found/ for more detail.
Tuesday, March 2, 2010 2:45 AM -
User-261252028 posted
I had exactly the same problem as @bryanc, except that it was Skype that was using port 80. So, it seems that this is the solution.
The most ironic thing is that when I logged into the http://forums.asp.net I received the same error
Tuesday, April 13, 2010 7:54 AM -
User1090817443 posted
I created a new applicatin pool and assigned it to my site, that solved the problem
Sunday, May 9, 2010 11:07 AM -
User146010426 posted
I agree with baselnimer , I had the same problem, couldn't figure it out and then created a new application pool and that fixed the problem. More specifically, the application pool I had been attempting to use had the 'Managed pipeline mode' set to 'Classic' mode, however the Web Application that was using this application pool required 'Integrated' mode (this was a Website created in a previous version of Visual Studio, converted to be used in Visual Studio 2010, then converted again to a Web Application using the 'Convert to Web Application' context command)
Previously I had gotten used to setting the 'Managed pipeline mode' to Classic and this is why I was stumped for a while, thanks to baselnimer for steering me in teh right direct, hope this helps someone else
baselnimer, I
Thursday, September 16, 2010 6:41 AM -
User1900948409 posted
Just FYI, for everyone, this actually is a firefox issue. if you view source, you'll see that there's no output. If you were to view the site in another browser, you wouldn't see this error.
The underlying error is in your application, but the browser hides it from you.
Wednesday, September 29, 2010 10:31 PM -
User1844770068 posted
I found another way that causes this error to be displayed instead of your asp.net page:
If you try to override the Render event method of the actual ASP.net page without adding "base.Render(writer);" (writer being the HtmlTextWriter parameter passed with the method) at the end of your implementation you'll certainly end up with this error. Try checking this one!!
Friday, December 31, 2010 1:21 PM -
User1498112871 posted
Just like everything else when it comes to software and computers. Frustrating and more frustrating then when you finally figure it out so easy. Thanks for the comments and articles you have curbed my frustrations.
Sincerely,
Mark Brett
Sunday, January 2, 2011 9:08 AM -
User1314980485 posted
I had the same error.
It was caused by invalid characters in my parameter values in the URL.
Dim ClearText as String = "fasfas8sdfgsf"
Dim str As String = StandardEncryption(ClearText) ' str contains % str = HttpUtility.UrlEncode(str) ' Fails Response.Redirect(String.Format("http://localhost/default.aspx?param={0}", str))A parameter value was encrypted using a standard encryption algorithm. This algorithm generated a cipher text that might but does not always contain %-characters. The encryption algorithm does of course not validate on whether the corresponding escape value are valid and it should not do so. However the HttpUtility.UrlEncode() method was originally used, but it does not filter on %-characters even it should (but does not) escape them if the corresponding escape value is invalid.
Dim ClearText as String = "fasfas8sdfgsf"
Dim str As String = StandardEncryption(ClearText) ' str contains % str = Convert.ToBase64String(Encoding.Unicode.GetBytes(str)) ' Works Response.Redirect(String.Format("http://localhost/default.aspx?param={0}", str))I replaced HttpUtility.UrlEncode() with Convert.ToBase64String() and it solved the problem.
HTH
Thursday, April 16, 2015 7:48 AM -
User333801061 posted
Sometimes it may be because the domains do not match. I mean when some page with WWW requests an XML without WWW.
Tuesday, January 26, 2016 10:51 PM