Add support for CDATA
See original GitHub issueThis is still the same issue as in #280 but since it is closed I reopen it.
Problem
I need the following XML output:
<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
<channel>
<title>My Feed</title>
<link>http://foo</link>
<description>My description</description>
<item>
<title>item title</title>
<link>http://bar</link>
<description><![CDATA[ <hello>world</hello> ]]></description>
</item>
</channel>
</rss>
However, I only get ROME to output this:
<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
<channel>
<title>My Feed</title>
<link>http://foo</link>
<description>My description</description>
<item>
<title>item title</title>
<link>http://bar</link>
<description><![CDATA[ <hello>world</hello> ]]></description>
</item>
</channel>
</rss>
Apparently the CDATA section is ignored and the content of “description” is escaped.
Question Is there any constellation how I can get ROME to produce an RSS V2 feed with an unescaped “description” section? Unfortunately I am implementing a given requirement so it has to be the “description” field.
This is my current code:
Channel feed = new Channel();
feed.setFeedType("rss_2.0");
feed.setTitle("My Feed");
feed.setDescription("My description");
feed.setLink("http://foo");
feed.setUri("http://feed-address");
Item item = new Item();
item.setTitle("item title");
item.setLink("http://bar");
Description description = new Description();
description.setType("application/xml");
description.setValue("<![CDATA[ <hello>world</hello> ]]>");
item.setDescription(description);
feed.setItems(Arrays.asList(item));
System.out.println(new WireFeedOutput().outputString(feed));
Many thanks for your support.
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (1 by maintainers)
Top Results From Across the Web
Technical Support - CData Software
We provide premium technical support via email and phone. All Premium emails and calls are given priority over any standard support questions. Responses...
Read more >CData Drivers
Robust connectivity: dynamic metadata, caching, replication, remoting, query pushdown, & more. Data Sources. Connect your BI, Analytics ...
Read more >CData Connect | Getting Started
We pack as many help resources into our products as we can and we make that same valuable information online. · ADO.NET Driver...
Read more >Online Help Files - CData Software
Online Help Files. Each online help file offers extensive overviews, samples, walk-throughs, and API documentation. ... Google Ad Manager. Google Ads.
Read more >REST Easy with CData Drivers
The CData Drivers for REST provide standards-based access to REST resources by modeling local and remote data as relational tables, views, ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Hi @samba2,
ROME does currently not support unescaped CDATA sections. The reasons are already explained the given issue #280. We currently have no resources to implement this feature.
If you don’t need other functionalities of ROME other than generating an RSS 2.0 feed, you have the possibility to use any XML library for that purpose at the moment.
I hope this helps. I’ll leave this issue open, maybe we will find some time to add CDATA support.
Regards, Patrick
@SvenWoltmann I came here due to smart news, too; here’s my dirty solution: