Legal Information |
|
The Controversial CDATA programming construct has caused something of a love-hate relationship among RSS programmers. CDATA allows us to place within the description sub-element of Item, HTML commands and language. In other words it extends the description by allowing us to create links, references and the like within what is purely a text element created to describe the item.
Within the Item element, the sub-element of description will look like this.
<description>Here is where I describe the item in my RSS feed</description>Let us say I want to extend this piece and I wanted to get a Bold command <B> </B>or italics <I> </I> command or something else within it. Maybe I want to be more sophisticated
<description>Heaven Scent Perfume the Smell your lover will die for. Created especially by Skunk Perfumes it is their newest and best selling perfume on the market today. Purchase a beautifully shaped skunk bottle with this incredible perfume and get a whopping 50% off! And if you purchase over $100 we will throw in Free overnight delivery as well!</description>
As an example not only is there a need to describe the HeavenScent Skunk Perfume but a picture of the bottle with the description is required. You can use the enclosure command. d, but it will NOT appear WITH the description. It will appear alone and then the user will have to read the description. So while this is fine for audio and video but not for a plain visual that I want next to a description .Thus the CDATA command. First lets look at it in action and then we will explain.
<description>[CDATA[<img border="0" src="http://www.randypandy.com/perfumes/heaven.JPG" width="138" height="180"/></a><p> Heaven Scent Perfume the Smell your lover will die for. Created especially by Skunk Perfumes it is their newest and best selling perfume on the market today. Purchase a beautifully shaped skunk bottle with this incredible perfume and get a whopping 50% off! And if you purchase over $100 we will throw in Free overnight delivery as well! </p><p>randypandy.com - All Perfumes You Can Ever desire</p> </p><br clear=all>]]</description>Notice that first we set the tag description.
<img border="0" src="http://www.randypandy.com/perfumes/heaven.JPG" width="138" height="180"/></a>After that we continue with our description. Then finally before the end we close it off with ]] tag.
You can get fairly sophisticated with CDATA. The thing is many programmers do NOT like it, as it allows too many rooms for mistakes, and it is a throwback to old HTML. The purity of the XML is kind of compromised here. But it serves a purpose and allows us to get a picture with the words, which is incredibly important.
Many, many RSS feeds use it, and it is a very useful tool to get the "picture" across to the user. You can combine it as well with enclosure, to get an audio out, a description, and say a picture of the Album. In other words a full media experience of text + picture + audio.
.Search Knowledge Base | Feedback |