Internet technology hosted by Berkman Center

Encoding & item-level descriptions

Thursday, June 3, 2004

These are examples of item-level descriptions, illustrating how encoding works with and without the use of CDATA (a feature of XML 1.0).

Each example consists of two lines, the first is an example description element, the second line is what the reader will see when viewing the description in a RSS 2.0-compatible aggregator.

The examples were provided by Nick Bradbury of Bradbury Software.

Example 1: Encoding HTML Tags 

<description>this is &lt;b&gt;bold&lt;/b&gt;</description>

this is bold

Example 2: Encoding HTML within a CDATA Section 

<description><![CDATA[this is <b>bold</b>]]></description>

this is bold

Example 3: Encoding angle brackets in text 

<description>5 &amp;lt; 8, ticker symbol &amp;lt;BIGCO&amp;gt;</description>

5 < 8, ticker symbol <BIGCO>

Example 4: Encoding angle brackets in text within a CDATA section 

<description><![CDATA[5 &lt; 8, ticker symbol &lt;BIGCO&gt;]]></description>

5 < 8, ticker symbol <BIGCO>