question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

CDATA sections being escaped

See original GitHub issue

Should the CDATA sections not be escaped? The following code results otherwise:

    SyndFeed feed = new SyndFeedImpl();
    feed.setFeedType("rss_2.0");
    feed.setTitle("title");
    feed.setLink("http://localhost/feed");
    feed.setDescription("description");

    SyndEntry entry = new SyndEntryImpl();
    entry.setTitle("entry title");
    entry.setUri("http://localhost/feed/item1");
    entry.setLink("<![CDATA[http://localhost/feed/item1]]>");

    SyndContent entryContent = new SyndContentImpl();
    entryContent.setValue("<![CDATA[<p>test</p><p>test</p>]]>");
    entry.getContents().add(entryContent);
    feed.getEntries().add(entry);

    SyndFeedOutput output = new SyndFeedOutput();
    System.out.println(output.outputString(feed));

Output:

<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" version="2.0">
  <channel>
    <title>title</title>
    <link>http://localhost/feed</link>
    <description>description</description>
    <item>
      <title>entry title</title>
      <link>&lt;![CDATA[http://localhost/feed/item1]]&gt;</link>
      <content:encoded>&lt;![CDATA[&lt;p&gt;test&lt;/p&gt;&lt;p&gt;test&lt;/p&gt;]]&gt;</content:encoded>
      <guid isPermaLink="false">http://localhost/feed/item1</guid>
    </item>
  </channel>
</rss>

I’ve tried Rome versions 1.0 and 1.5.1 but the results are similar. I’ve also tried different modes (xml, html) for content. Am I missing some setting here?

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:26 (16 by maintainers)

github_iconTop GitHub Comments

1reaction
Artgitcommented, Jan 27, 2018

Hello, how about the following:

An item may also be complete in itself, if so, the description contains the text (entity-encoded HTML is allowed; see examples) https://cyber.harvard.edu/rss/rss.html#hrelementsOfLtitemgt

0reactions
mishakocommented, Mar 30, 2018

@Artgit @krystiankaluzny Makes sense, but how does it relate to Rome not being able to produce cdata sections?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Is there a way to escape a CDATA end token in xml?
Yes there are multiple CDATA sections, and yes in rare cases this matters. But according to Oxford the broad definition in computing is...
Read more >
Avoid CDATA being removed and content being escaped - IBM
There is no way to figure out in a stylesheet which input XML elements contained CDATA sections, that is a general XML processing...
Read more >
CData Section getting escaped in RPC - ConfD User Community
Most likely either the Cdata is section itself is escaped . Below is example of rpc response which does not get parsed by...
Read more >
CDATA Escaping - Google Groups
I thought the point of CDATA was to eliminate the need to escape. ... CDATA section as HTML. ... is interpreted as HTML,...
Read more >
What Characters Need to be Escaped in XML Documents?
A CDATA section in XML is used to escape text containing characters which would otherwise be recognized as markup. It can appear anywhere ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found