我正在使用节点 RSS 模块生成RSS feed。 它工作正常,但标题和说明中的 CDATA [CDATA [测试]]
可以删除该CDATA吗?我尝试自己购买无法解决的那个。我希望输出带有CDATA属性。
我获得了包括CDATA在内的更多字段
标题,说明,版权,语言
var RSS = require('rss');
var feed = new RSS({
title: 'title',
generator: "hello",
description: 'description',
language: 'en-gb',
copyright: '2018,
});
/* loop over data and add to feed */
feed.item({
title: 'item title',
description: 'use this for the content. It can include html.',
});
// cache the xml to send to clients
var xml = feed.xml({
indent: true
});
console.log(xml);
当前输出:
<?xml >
<channel>
<title><![CDATA[Test]]></title>
<description><![CDATA[test desc]]></description>
<link>http://github.com/dylang/node-rss</link>
<generator>hello</generator>
<lastBuildDate>Fri, 13 Jul 2018 14:16:15 GMT</lastBuildDate>
<pubDate>Sun, 20 May 2012 04:00:00 GMT</pubDate>
<copyright><![CDATA[2018]]></copyright>
<language><![CDATA[en-gb]]></language>
<item>
<title><![CDATA[test1]]></title>
<description><![CDATA[test1 desc]]></description>
</item>
</channel>
</rss>
期望的输出:
<?xml >
<channel>
<title>Test</title>
<description>test desc</description>
<link>http://github.com/dylang/node-rss</link>
<generator>hello</generator>
<lastBuildDate>Fri, 13 Jul 2018 14:16:15 GMT</lastBuildDate>
<pubDate>Sun, 20 May 2012 04:00:00 GMT</pubDate>
<copyright>2018></copyright>
<language>en-gb</language>
<item>
<title>test1 </title>
<description>test1 desc</description>
</item>
</channel>
</rss>