Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Namespace prefix content on encoded is not defined #32

Closed
karan-kapoor90 opened this issue Aug 12, 2015 · 3 comments
Closed

Namespace prefix content on encoded is not defined #32

karan-kapoor90 opened this issue Aug 12, 2015 · 3 comments

Comments

@karan-kapoor90
Copy link

I'm using the following code to create a feed

app.get('/rss/:s1',function(req,res,next){
    console.log('Attempting to return feeds for:',req.params.s1);
    var feedObj = new Feed({
        title: 'Karan Kapoor',
        description: 'Karan Kapoor\'s content feed',
        link: 'http://somenet/rss/karan_kapoor',
        author : {
            name:'Karan Kapoor',
            link:'http://somenet/#!/karan_kapoor'   
        }
    });
    feedObj.addItem({
        title:  'Intro to Karan Kapoor',
        description: 'Something Something',
        link: 'http://somenet/#!/karan_kapoor', 
        date: new Date()
    });
    var feedXml = feedObj.render();//feed.xml({indent:true});
    res.set('Content-Type', 'text/xml');
    res.send(feedXml);
    console.log('Feed XML is :: ',feedXml);
});

And I get the following error on the page when I open the feed

This page contains the following errors:
error on line 16 at column 29: Namespace prefix content on encoded is not defined
Below is a rendering of the page up to the first error.

Karan Kapoor Karan Kapoor's content feed http://somenet/rss/karan_kapoor Wed, 12 Aug 2015 11:18:19 GMT http://blogs.law.harvard.edu/tech/rss Feed for Node.js http://somenet/#!/karan_kapoor http://somenet/#!/karan_kapoor Wed, 12 Aug 2015 11:18:19 GMT Something something

How can I fix this?

When I print the output of the feed on the console, I get

Feed XML is ::  <?xml version="1.0" encoding="utf-8"?>
<rss version="2.0">
<channel>
    <title>Karan Kapoor</title>
    <description>Karan Kapoor&apos;s content feed</description>
    <link>http://somenet/rss/karan_kapoor</link>
    <lastBuildDate>Wed, 12 Aug 2015 11:18:19 GMT</lastBuildDate>
    <docs>http://blogs.law.harvard.edu/tech/rss</docs>
    <generator>Feed for Node.js</generator>
    <item>
        <title><![CDATA[Intro to Karan Kapoor]]></title>
        <link>http://somenet/#!/karan_kapoor</link>
        <guid>http://somenet/#!/karan_kapoor</guid>
        <pubDate>Wed, 12 Aug 2015 11:18:19 GMT</pubDate>
        <description><![CDATA[Something Something]]></description>
        <content:encoded/>
    </item>
</channel>

Also, how do I get rid of the CDATA in the feed content?

@vkhattar
Copy link

I am having the same problem, did you find a fix by any chance ?

@delight09
Copy link

hi karan,

You can hack the lib/feed.js to disable CDATA wrapper on feed content.
Here is a working example, delight09@39e7d05

@jpmonette
Copy link
Owner

Please, if this is still an issue, feel free to re-open using the New Feature Issue template. Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants