Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Allan Hawkey 232 posts 303 karma points
    Nov 17, 2014 @ 14:01
    Allan Hawkey
    0

    Error from RssReader.cs

    I'm getting lots of errors like this:

    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.

    I am using uBlogsy 2.1.1.1 in Umbraco 4.11.10

  • Jan Skovgaard 11280 posts 23678 karma points MVP 11x admin c-trib
    Nov 17, 2014 @ 15:10
    Jan Skovgaard
    0

    Hi Allan

    Are there any weird characters before the XML prolog that need to be in top of the RSS feed template?

    /Jan

  • Allan Hawkey 232 posts 303 karma points
    Nov 17, 2014 @ 15:19
    Allan Hawkey
    0

    Hi Jan, thanks for your reply.  Not sure I follow what you mean though?!  Thanks, Allan

  • Jan Skovgaard 11280 posts 23678 karma points MVP 11x admin c-trib
    Nov 17, 2014 @ 15:30
    Jan Skovgaard
    0

    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

  • Allan Hawkey 232 posts 303 karma points
    Nov 17, 2014 @ 15:45
    Allan Hawkey
    0

    ok, so the RSS template is as follows (I think this is the default with the uBlogsy package) - does it look ok?

    <%@ Master Language="C#" MasterPageFile="~/masterpages/uBlogsyBase.master" AutoEventWireup="true" %>

    <%--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>
  • Jan Skovgaard 11280 posts 23678 karma points MVP 11x admin c-trib
    Nov 17, 2014 @ 15:49
    Jan Skovgaard
    0

    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

  • Allan Hawkey 232 posts 303 karma points
    Nov 17, 2014 @ 16:02
    Allan Hawkey
    0

    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"];
       
        IEnumerable<DynamicNode> posts = PostService.Instance.GetPosts(Model.Id, tag, category, author, searchTerm, commenter, 0, int.MaxValue); posts = posts.OrderByDescending(x => x.GetProperty("uBlogsyPostDate").Value);
          
        string lastPubDate;
        if (posts.Count() == 0)
        {
            lastPubDate = DateTime.Now.ToString();
        }
        else
        {
            lastPubDate = posts.FirstOrDefault().GetProperty("uBlogsyPostDate").Value;
        }


       
      
        // get landing page
        var landing = DataService.Instance.GetLanding(Model.Id);

        // get blog url
        string blogUrl = Request.Url.AbsoluteUri.Replace("/club-news", string.Empty).Replace("/news", string.Empty).Replace("?category=Coaching%20and%20Training", string.Empty).Replace("?category=Events%20and%20Championships", string.Empty).Replace("?category=Club%20News", string.Empty).Replace("?category=Social", string.Empty).Replace("?category=Awards", string.Empty).Replace("/rss", string.Empty).TrimEnd("/".ToCharArray());
        <rss version="2.0">
            <channel>
                <title>@landing.uBlogsyRssTitle</title>
                <description>@landing.uBlogsyRssDescription</description>
                <copyright>@landing.uBlogsyRssCopyright</copyright>
                @*<image>@landing.uBlogsyRssImage</image>*@
                <link>@blogUrl</link>
                <lastBuildDate>@lastPubDate.FormatDateTime("ddd, dd MMM yyyy HH:mm:ss") GMT</lastBuildDate>
                <pubDate>@lastPubDate.FormatDateTime("ddd, dd MMM yyyy HH:mm:ss") GMT</pubDate>

                @foreach (var p in posts)
                {
                    if (!p.IsProtected)
                    {
                    <item>
                        <title>@p.GetProperty("uBlogsyContentTitle").Value</title>
                        <author>@landing.uBlogsyContactEmail (@p.GetProperty("uBlogsyPostAuthor").Value)</author>
                        <comments>@[email protected]</comments>
                        <description>@p.GetProperty("uBlogsyContentBody").Value.StripHtml().Trim()</description>
                        <link>@[email protected]</link>
                        <guid>@[email protected]</guid>
                        <pubDate>@p.GetProperty("uBlogsyPostDate").Value.FormatDateTime("ddd, dd MMM yyyy HH:mm:ss") GMT</pubDate>
                    </item>
                    }
                }
            </channel>
        </rss>
    }
  • Jan Skovgaard 11280 posts 23678 karma points MVP 11x admin c-trib
    Nov 17, 2014 @ 17:48
    Jan Skovgaard
    0

    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

  • Allan Hawkey 232 posts 303 karma points
    Nov 17, 2014 @ 18:01
    Allan Hawkey
    0

    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

  • Jan Skovgaard 11280 posts 23678 karma points MVP 11x admin c-trib
    Nov 17, 2014 @ 19:12
    Jan Skovgaard
    0

    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

  • Allan Hawkey 232 posts 303 karma points
    Nov 17, 2014 @ 19:33
    Allan Hawkey
    0

    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

  • Jan Skovgaard 11280 posts 23678 karma points MVP 11x admin c-trib
    Nov 17, 2014 @ 19:38
    Jan Skovgaard
    0

    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

  • Allan Hawkey 232 posts 303 karma points
    Nov 17, 2014 @ 20:12
    Allan Hawkey
    0

    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

  • Jan Skovgaard 11280 posts 23678 karma points MVP 11x admin c-trib
    Nov 17, 2014 @ 20:28
    Jan Skovgaard
    0

    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

Please Sign in or register to post replies

Write your reply to:

Draft