System.Xml.XmlException: Data at the root level is invalid. Line 1,
position 40.
at System.Xml.XmlTextReaderImpl.Throw(String res, String arg)
at System.Xml.XmlTextReaderImpl.ParseRootLevelWhitespace()
at System.Xml.XmlTextReaderImpl.ParseDocumentContent()
at System.Xml.XmlLoader.LoadDocSequence(XmlDocument parentDoc)
at System.Xml.XmlDocument.Load(XmlReader reader)
at uBlogsy.Common.Helpers.RssReader.Execute() in
d:\_PROJECTS\Personal\uBlogsy HG\uBlogsy
HG\uBlogsy\uBlogsy.Common\Helpers\RssReader.cs:line 149
Any ideas what could be causing these? If it's the Blog Roll (which I suspect it is), this is simply pulling in an RSS feed from another of my sites which also uses uBlogsy for its blog.
If you have access to the "Settings" section of Umbraco then go to it and expand the "templates" folder - and go to the RSS template and see if it contains a XML prolog, which should look like this - If anything appears before it you will typically see the above error.
<%--NOTE: this file must be kept in this format because the xml declaration must be in the first line.--%> <asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolderDefault" runat="server"><script type="text/C#" runat="server"> protected override void OnPreRender(EventArgs e) { Response.Clear(); Response.ContentType = "text/xml"; Response.ContentEncoding = System.Text.Encoding.UTF8; } </script><?xml version="1.0" encoding="UTF-8" ?><umbraco:macro ID="Macro1" runat="server" Alias="uBlogsyRSS" /> </asp:Content>
Yes, both sites are the same versions of umbraco and uBlogsy.
The macro is just the standard settings again, as far as I know, and refers to /uBlogsy/uBlogsyRSS.cshtml which is as follows:
@{ /* RSS FEED */ } @using System.Linq @using System.Xml.Linq @using umbraco.MacroEngines @using uBlogsy.Common.Extensions @using uBlogsy.Common.Helpers @using uBlogsy.BusinessLogic @{ // get all posts // get tag, category, or author from query string var tag = Request.QueryString["tag"]; var category = Request.QueryString["category"]; var author = Request.QueryString["author"]; var searchTerm = Request.QueryString["search"]; var commenter = Request.QueryString["commenter"];
Are both sites running on the same server or different ones? A long shot could be to simply try and republish the entire site by right clicking the "Content" node and select "Republish entire site".
Both sites are on the same server. When the error arises, the entire site goes down with a 404 error. The fix is to republish the entire site (as you suggest) but that doesn't prevent the error from recurring again in future. I'd really like to get to the root cause of this so we can prevent it, rather than have to republish everything each time the site goes down.
Ok then I got one more thing to ask/test :)...so do you have any weird special characters in the one install that fails from time to time? Is there something that could perhaps make the umbraco.config file crash when Umbraco is trying to parse it?
I bet there is but I don't know of any tools that can do it though. I would probably see if I could find an online xml parser and then paste the content from the /app_data/umbraco.config file into it. Perhaps try this one http://www.xmlvalidation.com/ - As I have not been using it myself I don't know if it has any quirks though or whether it's reliable or not.
OK - that gives me loads of errors - 7619 of them! Here's the first few lines - is there an external XML schema document I should be checking it against?
Ok, then that's not the way to go about checking it. I suppose the errors (Which are not displayed in the post btw) are just some minor stuff about wellformedness of the XML document etc.
I don't think you should proceed down that path since it's probably leading to more confusion than solutions.
But I'm afraid I'm all out of ideas about what the issue on that one site can be.
Error from RssReader.cs
I'm getting lots of errors like this:
Any ideas what could be causing these? If it's the Blog Roll (which I suspect it is), this is simply pulling in an RSS feed from another of my sites which also uses uBlogsy for its blog.
I am using uBlogsy 2.1.1.1 in Umbraco 4.11.10
Hi Allan
Are there any weird characters before the XML prolog that need to be in top of the RSS feed template?
/Jan
Hi Jan, thanks for your reply. Not sure I follow what you mean though?! Thanks, Allan
Hi Allan
If you have access to the "Settings" section of Umbraco then go to it and expand the "templates" folder - and go to the RSS template and see if it contains a XML prolog, which should look like this - If anything appears before it you will typically see the above error.
Hope this makes any sense :)
/Jan
ok, so the RSS template is as follows (I think this is the default with the uBlogsy package) - does it look ok?
Hi Allan
Yes, that appears to be correct setup in the template.
Are both your Umbraco installations and versions of uBlogsy identical? I mean are both Umbraco 4.11.10 and uBlogsy 2.1.1.1 ?
What does the code for the uBlogsyRss macro look like?
/Jan
Yes, both sites are the same versions of umbraco and uBlogsy.
The macro is just the standard settings again, as far as I know, and refers to /uBlogsy/uBlogsyRSS.cshtml which is as follows:
Hi Allan
Ok, that's really odd...I'm a bit clueless know.
Are both sites running on the same server or different ones? A long shot could be to simply try and republish the entire site by right clicking the "Content" node and select "Republish entire site".
/Jan
Hi Jan
Both sites are on the same server. When the error arises, the entire site goes down with a 404 error. The fix is to republish the entire site (as you suggest) but that doesn't prevent the error from recurring again in future. I'd really like to get to the root cause of this so we can prevent it, rather than have to republish everything each time the site goes down.
Any more ideas?
Thanks
Allan
Hi Allan
Ok then I got one more thing to ask/test :)...so do you have any weird special characters in the one install that fails from time to time? Is there something that could perhaps make the umbraco.config file crash when Umbraco is trying to parse it?
/Jan
Hi Jan
Nothing that I'm aware of, but is there some way to check this in case something weird has crept in somehow?
Thanks
Allan
Hi Allan
I bet there is but I don't know of any tools that can do it though. I would probably see if I could find an online xml parser and then paste the content from the /app_data/umbraco.config file into it. Perhaps try this one http://www.xmlvalidation.com/ - As I have not been using it myself I don't know if it has any quirks though or whether it's reliable or not.
/Jan
OK - that gives me loads of errors - 7619 of them! Here's the first few lines - is there an external XML schema document I should be checking it against?
Thanks
Allan
Hi Allan
Ok, then that's not the way to go about checking it. I suppose the errors (Which are not displayed in the post btw) are just some minor stuff about wellformedness of the XML document etc.
I don't think you should proceed down that path since it's probably leading to more confusion than solutions.
But I'm afraid I'm all out of ideas about what the issue on that one site can be.
/Jan
is working on a reply...