Copied to clipboard

Flag this post as spam?

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


  • Lee 1130 posts 3088 karma points
    Feb 11, 2010 @ 13:15
    Lee
    0

    White Space In RSS Feed (Beginning)

    I am trying to validate an RSS feed which is being created in my XSLT - However it keeps coming back with the following

    This feed does not validate.

    • line 2, column 1: XML parsing error: <unknown>:2:1: XML or text declaration not at start of entity [help]

       <?xml version="1.0" encoding="UTF-8"?><rss version="2.0" xmlns:content="htt ...

    Here is the beginning of the XSLT

    <xsl:value-of select="umbraco.library:ChangeContentType('text/xml')"/>
    <xsl:text disable-output-escaping="yes">&lt;?xml version="1.0" encoding="UTF-8"?&gt;</xsl:text>
    <rss version="2.0"
        xmlns:content="http://purl.org/rss/1.0/modules/content/"
        xmlns:wfw="http://wellformedweb.org/CommentAPI/"
        xmlns:dc="http://purl.org/dc/elements/1.1/">

    I think its because of the space before the XML starts?  Anyone else experienced this?  

  • dandrayne 1138 posts 2262 karma points
    Feb 11, 2010 @ 13:47
    dandrayne
    3

    I would put the

    <?xml version="1.0" encoding="UTF-8"?>

    Into the template, and also remove any line breaks and spaces before the .net content placeholders.  This should get around these problems,

    As in, something like this

    <%@ Master Language="C#" MasterPageFile="/umbraco/masterpages/default.master" AutoEventWireup="true" %>
    <asp:Content ContentPlaceHolderID="ContentPlaceHolderDefault" runat="server"><?xml version="1.0" encoding="UTF-8"?>

    Also, the MIME type

    application/rss+xml

    Seems to make sure all browsers render the feed as a feed when viewed directly via the browser

    Might work!

    Dan

     

  • Lee 1130 posts 3088 karma points
    Feb 11, 2010 @ 13:50
    Lee
    0

    Good idea dan I'll give that a go

  • Lee 1130 posts 3088 karma points
    Feb 11, 2010 @ 13:54
    Lee
    0

    Found the problem based off Dans post - It was actually some whitespace in the template!  Just removed that and bobs your uncle, fanny's your aunt, bing, bang, bong it works.

Please Sign in or register to post replies

Write your reply to:

Draft