ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

Invalid XML encoding name

March 09, 2012 5:20am

Subscribe [4]
  • #1 / Mar 09, 2012 5:20am

    tlloyduk

    29 posts

    Hi Guys,

    I’ve set up a template which is an RSS page and I’m using the code below. If I view it in the browser it comes up with an error “Invalid XML encoding name”:

    This page contains the following errors:

    error on line 1 at column 29: Invalid XML encoding name
    Below is a rendering of the page up to the first error.

    Any ideas? I couldn’t find anything in the forum search matching this error.

    I’m using ExpressionEngine 2.1.3 so perhaps this is fixed in the newer 2.4.

    {exp:rss:feed channel="kb_articles_{language_code}" status="not closed"}
    <?xml version="1.0" encoding="{encoding}"?>
    <rss version="2.0"
        xmlns:dc="http://purl.org/dc/elements/1.1/"
        xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
        xmlns:admin="http://webns.net/mvcb/"
        xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
        xmlns:content="http://purl.org/rss/1.0/modules/content/">
    
        <channel>
    
        <title><![CDATA[{channel_name}]]></title>
        <link>{channel_url}</link>
        <description>{channel_description}</description>
        <dc:language>{channel_language}</dc:language>
        <dc:creator>{email}</dc:creator>
        <dc:rights>Copyright {gmt_date format="%Y"}</dc:rights>
        <dc:date>{gmt_date format="%Y-%m-%dT%H:%i:%s%Q"}</dc:date>
        <admin:generatorAgent rdf:resource="http://www.censornet.com/" >
    
    {exp:channel:entries channel="kb_articles_{language_code}" dynamic_start="on" disable="member_data|pagination" status="open"}
        <item>
          <title><![CDATA[{title}]]></title>
          <link>{title_permalink='kb'}</link>
    <guid>{title_permalink='blog'}#When:{gmt_entry_date format="%H:%i:%sZ"}</guid>
          <description><![CDATA[{blog_summary_en}{body}]]></description>
          <dc:subject><![CDATA[{categories backspace="2"}{category_name}, {/categories}]]></dc:subject>
          <dc:date>{gmt_entry_date format="%Y-%m-%dT%H:%i:%s%Q"}</dc:date>
        </item>
    {/exp:channel:entries}
    
        </channel>
    </rss>
    {/exp:rss:fee}

    Thanks for any help / advice.

    Tim

  • #2 / Mar 09, 2012 5:15pm

    Shane Eckert

    7174 posts

    Hello tlloyduk,

    I am sorry to hear you are running into this problem.

    It might be lost in transport, but your closing tag is a little funny looking.

    {/exp:rss:fee}  should be {/exp:rss:feed}

    Can you update that and let me know if it works?

    Cheers,

  • #3 / Mar 10, 2012 4:06am

    tlloyduk

    29 posts

    Whoops - well spotted. I did miss off the ‘d’ however the same error happens.

  • #4 / Mar 10, 2012 5:32am

    mark186282

    290 posts

    Would you have the rendered XML available for inspection (or a PM with a link?)

    The browser is working with the rendered XML - that’s what we should be looking at to find the cause of the error.

    Should be able to inspect the finished product, look up the line number and find out what’s going on.

    I hope this helps,
    -Mark

  • #5 / Mar 10, 2012 5:36am

    tlloyduk

    29 posts

    Thanks Mark - I’ve sent a PM with the link. I think the trouble is this bit:

    <?xml version="1.0" encoding=""?>
    <rss version="2.0"
        xmlns:dc="http://purl.org/dc/elements/1.1/"
        xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
        xmlns:admin="http://webns.net/mvcb/"
        xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
        xmlns:content="http://purl.org/rss/1.0/modules/content/">
    
        <channel>

    The encoding=”{encoding}” part of the tag doesn’t appear to be working

  • #6 / Mar 10, 2012 5:40am

    mark186282

    290 posts

    ah, perfect.

    In your channel preferences, what do you have your encoding set to?

    Check this page out for details:

    http://ellislab.com/expressionengine/user-guide/cp/admin/channels/channel_edit_preferences.html

  • #7 / Mar 10, 2012 5:43am

    tlloyduk

    29 posts

    Interesting

    In Channel Preferences I have XML Language field set to English but there is no XML Encoding field ??

  • #8 / Mar 10, 2012 5:44am

    tlloyduk

    29 posts

    Here is a screenshot

  • #9 / Mar 10, 2012 5:47am

    mark186282

    290 posts

    ah, must have been added after 1.1.3

    No worries, manually enter your encoding (most likely utf-8… unless you’re doing something different)

    replace your line one with:

    <?xml version="1.0" encoding="utf-8"?>
  • #10 / Mar 10, 2012 5:51am

    tlloyduk

    29 posts

    Still the same, it still shows the encoding as blank.

    However if I go to Template Manager, click the template group, then click Edit Preferences on my rss template and change the type to “Web Page”, it shows the change to encoding=”” in the browser View Source. As soon as I change the type back to “RSS Page” then I get the error and the encoding is blank

  • #11 / Mar 10, 2012 8:04am

    mark186282

    290 posts

    I clicked on your link a little while and it was working, while the encoding was utf-8

    however, what I mean is in your template hard-code the value (don’t use the {encoding} tag)

    Replace:

    {exp:rss:feed channel="kb_articles_{language_code}" status="not closed"}
    <?xml version="1.0" encoding="{encoding}"?>

    with

    {exp:rss:feed channel="kb_articles_{language_code}" status="not closed"}
    <?xml version="1.0" encoding="utf-8"?>

    it appears that the {encoding} variable was added after 1.1.3

     

  • #12 / Mar 10, 2012 8:05am

    tlloyduk

    29 posts

    I did that but it still doesn’t work if template type is RSS Page. When you clicked on the link, it was probably when I had set the template type to be Web Page. If you try it now, you will see it’s back to the same problem, and in the template the encoding type is hard coded - but blank in the rendered page.

  • #13 / Mar 12, 2012 12:13pm

    Kyle Cotter

    730 posts

    Hey tlloyduk,

    Is it possible for you to post the link in question here on the thread, or post the current XML output of the page?

    ExpressionEngine 2.1.3 is a dated version, and updating is certainly something you may want to consider in the near future.

    Though, hard coding the encoding in the RSS template should have solved the issue.

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

    If I can see the output of the feed, with the encoding hard coded, I’d appreciate it.

    Thanks! And thanks to Mark for the assist.

  • #14 / Mar 12, 2012 12:51pm

    tlloyduk

    29 posts

    Hi,

    Thanks for the follow up.

    After discussing with Mark it seems that when I was updating the files outside of EE using emacs, the changes weren’t being reflected. When I edited the file through EE template manager and hard coded the encoding type, that worked fine.

    So bit of a strange one but it’s working now 😊

    Thanks

  • #15 / Mar 12, 2012 1:25pm

    Kyle Cotter

    730 posts

    Glad you got everything taken care of, tlloyduk. If you have any more issues, feel free to start a new thread.

    Thanks!

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases