Re: CDATA the title and description?

Jon Hanna <jon-YK+g4hZFQDMeIZ0/[email protected]> Mon, 28 May 2007 00:09:06 +0100
Newsgroups gmane.network.syndication.rss.devel
Message-ID <[email protected]>
--1EkBfXfEH3NqVxkBBxZW3XzxUHB41tFRqSO0mwy
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit

Clinton Gallagher wrote:
> So it seems to be a general consensus that CDATA within the title and the
> description is widely supported at this point in time as a means to allow
> users to submit data such as the word AT&T in a title or description? What
> are the generally accepted pitfalls of using CDATA?

It's pretty depressing that "widely supported" can even be talked about 
in this case. It's 9 years since XML became a recommendation. There are 
kids out there younger than XML that understand CDATA, and some of the 
parsers don't. :(

Anyway the biggest pitfall I can see with CDATA at the authors side is 
the belief that you can pass anything through without having to worry 
about escaping anything - there is the exception of the string "]]>". 
Now granted the string ]]> doesn't come up very much in normal 
conversation, but it certainly can come up in technical posts, etc. and 
of course Murphy's law applies - if there's a set of inputs that will 
cause failure someone will give you that set of inputs.

As such you still have to do escaping with anything you are putting into 
a CDATA section so that ]]> gets replaced with ]]>]<![CDATA[]> (there 
are a couple of other workable equivalents).

Personally, I tend to find it just as handy to escape & and < to &amp; 
and &lt; (and > to &gt; though in most cases that should be safe - but 
again there are parsers that may think differently) especially since I 
got into the habit of looking for those a long time ago when dealing 
with HTML (not to say I never ever overlook that those characters could 
be coming into a given piece of code, but I'm still well used to looking 
out for them and not for ]]>


--1EkBfXfEH3NqVxkBBxZW3XzxUHB41tFRqSO0mwy
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: 7bit


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
</head>

<!-- Network content -->


<body style="background-color: #ffffff;">

<!--~-|**|PrettyHtmlStartT|**|-~-->
<div id="ygrp-mlmsg" style="width:655px; position:relative;">
  <div id="ygrp-msg" style="width: 490px; padding: 0 15px 0 0; float:left;  z-index:1;">
<!--~-|**|PrettyHtmlEndT|**|-~-->

    <div id="ygrp-text">
            <p>Clinton Gallagher wrote:<br>
&gt; So it seems to be a general consensus that CDATA within the title and the<br>
&gt; description is widely supported at this point in time as a means to allow<br>
&gt; users to submit data such as the word AT&amp;T in a title or description? What<br>
&gt; are the generally accepted pitfalls of using CDATA?<br>
<br>
It's pretty depressing that &quot;widely supported&quot; can even be talked about <br>
in this case. It's 9 years since XML became a recommendation. There are <br>
kids out there younger than XML that understand CDATA, and some of the <br>
parsers don't. :(<br>
<br>
Anyway the biggest pitfall I can see with CDATA at the authors side is <br>
the belief that you can pass anything through without having to worry <br>
about escaping anything - there is the exception of the string &quot;]]&gt;&quot;. <br>
Now granted the string ]]&gt; doesn't come up very much in normal <br>
conversation, but it certainly can come up in technical posts, etc. and <br>
of course Murphy's law applies - if there's a set of inputs that will <br>
cause failure someone will give you that set of inputs.<br>
<br>
As such you still have to do escaping with anything you are putting into <br>
a CDATA section so that ]]&gt; gets replaced with ]]&gt;]&lt;![CDATA[<wbr>]&gt; (there <br>
are a couple of other workable equivalents)<wbr>.<br>
<br>
Personally, I tend to find it just as handy to escape &amp; and &lt; to &amp;amp; <br>
and &amp;lt; (and &gt; to &amp;gt; though in most cases that should be safe - but <br>
again there are parsers that may think differently) especially since I <br>
got into the habit of looking for those a long time ago when dealing <br>
with HTML (not to say I never ever overlook that those characters could <br>
be coming into a given piece of code, but I'm still well used to looking <br>
out for them and not for ]]&gt;<br>
<br>
</p>
    </div>  

    <!--~-|**|PrettyHtmlStart|**|-~-->
    <span width="1" style="color: white;">__._,_.___</span>
    <!-- Start the section with Message In topic -->
    <div id="ygrp-actbar">
              <span class="left">
          <a href="http://groups.yahoo.com/group/rss-dev/message/7431;_ylc=X3oDMTM0Y2Y2NzlkBF9TAzk3MzU5NzE0BGdycElkAzIwOTEwODYEZ3Jwc3BJZAMxNzA2MDMwMzkwBG1zZ0lkAzc0MzMEc2VjA2Z0cgRzbGsDdnRwYwRzdGltZQMxMTgwMzA3NDg0BHRwY0lkAzc0MzE-">
            Messages in this topic          </a> (<span class="bld">0</span>)
        </span>
        <a href="http://groups.yahoo.com/group/rss-dev/post;_ylc=X3oDMTJwYTYxcnA2BF9TAzk3MzU5NzE0BGdycElkAzIwOTEwODYEZ3Jwc3BJZAMxNzA2MDMwMzkwBG1zZ0lkAzc0MzMEc2VjA2Z0cgRzbGsDcnBseQRzdGltZQMxMTgwMzA3NDg0?act=reply&messageNum=7433">
          <span class="bld">
            Reply          </span> (via web post)
        </a>  | 
        <a href="http://groups.yahoo.com/group/rss-dev/post;_ylc=X3oDMTJldXZ0NXBtBF9TAzk3MzU5NzE0BGdycElkAzIwOTEwODYEZ3Jwc3BJZAMxNzA2MDMwMzkwBHNlYwNmdHIEc2xrA250cGMEc3RpbWUDMTE4MDMwNzQ4NA--" class="bld">
          Start a new topic        </a>
          </div> 
    <!-------     Start Nav Bar  ------>
    <!-- |**|begin egp html banner|**| -->
    <div id="ygrp-vitnav">
                <a href="http://groups.yahoo.com/group/rss-dev/messages;_ylc=X3oDMTJlbm4zZzcxBF9TAzk3MzU5NzE0BGdycElkAzIwOTEwODYEZ3Jwc3BJZAMxNzA2MDMwMzkwBHNlYwNmdHIEc2xrA21zZ3MEc3RpbWUDMTE4MDMwNzQ4NA--">Messages</a>  
        
        
        
        
            |    <a href="http://groups.yahoo.com/group/rss-dev/polls;_ylc=X3oDMTJmZ200Y2hhBF9TAzk3MzU5NzE0BGdycElkAzIwOTEwODYEZ3Jwc3BJZAMxNzA2MDMwMzkwBHNlYwNmdHIEc2xrA3BvbGxzBHN0aW1lAzExODAzMDc0ODQ-">Polls</a>  
            |    <a href="http://groups.yahoo.com/group/rss-dev/members;_ylc=X3oDMTJldXRxOXJyBF9TAzk3MzU5NzE0BGdycElkAzIwOTEwODYEZ3Jwc3BJZAMxNzA2MDMwMzkwBHNlYwNmdHIEc2xrA21icnMEc3RpbWUDMTE4MDMwNzQ4NA--">Members</a>  
        
    </div>  
    <!-- |**|end egp html banner|**| -->

    <!-- Do not have place to put it yet -->
    <div id="ygrp-grft">
          </div>

    <!-- yahoo logo -->
    <!-- |**|begin egp html banner|**| -->
    <div id="ygrp-ft">
      <a href="http://groups.yahoo.com/;_ylc=X3oDMTJkcGV0ZXNxBF9TAzk3MzU5NzE0BGdycElkAzIwOTEwODYEZ3Jwc3BJZAMxNzA2MDMwMzkwBHNlYwNmdHIEc2xrA2dmcARzdGltZQMxMTgwMzA3NDg0">
      <img src="http://us.i1.yimg.com/us.yimg.com/i/yg/img/logo/ma_grp_160.gif" height="15" width="106" border="0" alt="Yahoo! Groups"></a> <br>
      <a href="http://groups.yahoo.com/group/rss-dev/join;_ylc=X3oDMTJmdDBzc3VrBF9TAzk3MzU5NzE0BGdycElkAzIwOTEwODYEZ3Jwc3BJZAMxNzA2MDMwMzkwBHNlYwNmdHIEc2xrA3N0bmdzBHN0aW1lAzExODAzMDc0ODQ-">Change settings via the Web</a> (Yahoo! ID required) <br>
      Change settings via email: <a href="mailto:[email protected]?subject=Email Delivery: Digest">Switch delivery to Daily Digest</a> | <a href = "mailto:[email protected]?subject=Change Delivery Format: Traditional">Switch format to Traditional</a> <br>

      <a href="http://groups.yahoo.com/group/rss-dev;_ylc=X3oDMTJkamxtaHE0BF9TAzk3MzU5NzE0BGdycElkAzIwOTEwODYEZ3Jwc3BJZAMxNzA2MDMwMzkwBHNlYwNmdHIEc2xrA2hwZgRzdGltZQMxMTgwMzA3NDg0">
        Visit Your Group 
      </a> |
      <a href="http://docs.yahoo.com/info/terms/">
        Yahoo! Groups Terms of Use      </a> |
      <a href="mailto:[email protected]?subject=">
        Unsubscribe      </a> 
    </div>     <!-- |**|end egp html banner|**| -->
  </div> <!-- ygrp-msg -->

  
  <!-- Sponsor -->
  <!-- |**|begin egp html banner|**| -->
  <div id="ygrp-sponsor" style="width:140px;float: left; clear: none; margin-left: 5px; background:white; margin-bottom:25px ;position:absolute; top:0; right: 0;">
    <!-- Network content -->
    
    <!-- Start vitality -->
    <div id="ygrp-vital">
              <div id="vithd">Recent Activity</div>
        <ul style="list-style-type:none; padding: 0; margin: 2px 0;">
                <li style="clear: both;">
      <div class="ct" style="float: right;"><span style="display:none">&nbsp;</span>1</div>
      <div class="cat"><a href="http://groups.yahoo.com/group/rss-dev/members;_ylc=X3oDMTJmbGU4NGQxBF9TAzk3MzU5NzE0BGdycElkAzIwOTEwODYEZ3Jwc3BJZAMxNzA2MDMwMzkwBHNlYwN2dGwEc2xrA3ZtYnJzBHN0aW1lAzExODAzMDc0ODQ-">New Members</a></div>
    </li>
  
            
            
            
            
            
        </ul>
            <a href="http://groups.yahoo.com/group/rss-dev;_ylc=X3oDMTJlMDZvdG10BF9TAzk3MzU5NzE0BGdycElkAzIwOTEwODYEZ3Jwc3BJZAMxNzA2MDMwMzkwBHNlYwN2dGwEc2xrA3ZnaHAEc3RpbWUDMTE4MDMwNzQ4NA--">
        Visit Your Group      </a>
    </div> 
              
    <!-- Network content -->
              <div id="nc">
              <div class="ad">
                      <div id="hd1">Yahoo! Finance</div> 
<p><a href="http://us.ard.yahoo.com/SIG=12jjt9j34/M=493064.10729649.11333340.8674578/D=groups/S=1706030390:NC/Y=YAHOO/EXP=1180314686/A=4507179/R=0/SIG=12de4rskk/*http://us.rd.yahoo.com/evt=50284/*http://finance.yahoo.com/personal-finance">It's Now Personal</a></p> 
<p>Guides, news,</p> 
<p>advice & more.</p>                   </div>
                    <div class="ad">
                      <div id="hd1">New business?</div> 
<p><a href="http://us.ard.yahoo.com/SIG=12jhb9ooc/M=493064.10729656.11333347.8674578/D=groups/S=1706030390:NC/Y=YAHOO/EXP=1180314686/A=3848640/R=0/SIG=131an6mds/*http://searchmarketing.yahoo.com/arp/srchv2.php?o=US2002&cmp=Yahoo&ctv=Groups1&s=Y&s2=&s3=&b=50">Get new customers.</a></p> 
<p>List your web site</p> 
<p>in Yahoo! Search.</p>                  </div>
                    <div class="ad">
                      <div id="hd1">Yahoo! Groups</div> 
<p><a href="http://us.ard.yahoo.com/SIG=12jcqre65/M=493064.10771301.11374985.8674578/D=groups/S=1706030390:NC/Y=YAHOO/EXP=1180314686/A=4609192/R=0/SIG=11n05oee3/*http://www.myfeedback.cfigroup.com/launch/svy307.html">Take a Survey</a></p> <p>express your ideas</p> <p>share your opinion</p>                  </div>
          </div>
    
  </div>   <!-- |**|end egp html banner|**| -->
  <div style="clear:both; color: #FFF; font-size:1px;">.</div>
</div>   <img src="http://geo.yahoo.com/serv?s=97359714/grpId=2091086/grpspId=1706030390/msgId=7433/stime=1180307484/nc1=4507179/nc2=3848640/nc3=4609192" width="1" height="1"> <br>

<span  style="color: white;">__,_._,___</span>
<!--~-|**|PrettyHtmlEnd|**|-~-->
</body>
<!--~-|**|PrettyHtmlStart|**|-~-->
<head>
<style type="text/css">
<!--
#ygrp-mlmsg {font-size:13px; font-family: arial,helvetica,clean,sans-serif;*font-size:small;*font:x-small;}
#ygrp-mlmsg table {font-size:inherit;font:100%;}
#ygrp-mlmsg select, input, textarea {font:99% arial,helvetica,clean,sans-serif;}
#ygrp-mlmsg pre, code {font:115% monospace;*font-size:100%;}
#ygrp-mlmsg * {line-height:1.22em;}
#ygrp-text{
    font-family: Georgia;	
}
#ygrp-text p{
    margin: 0 0 1em 0;
}
#ygrp-tpmsgs{
    font-family: Arial;	
    clear: both;
}
#ygrp-vitnav{
	padding-top: 10px;
	font-family: Verdana;
	font-size: 77%;
	margin: 0;
}
#ygrp-vitnav a{
	padding: 0 1px;
}
#ygrp-actbar{
	clear: both;
	margin: 25px 0;
	white-space:nowrap;
	color: #666;
	text-align: right;
}
#ygrp-actbar .left{
	float: left;
	white-space:nowrap;
}
.bld{font-weight:bold;}
#ygrp-grft{
	font-family: Verdana;
	font-size: 77%;
	padding: 15px 0;
}
#ygrp-ft{
  font-family: verdana;
  font-size: 77%;
  border-top: 1px solid #666; 
  padding: 5px 0; 
}
#ygrp-mlmsg #logo{
  padding-bottom: 10px;
}

#ygrp-vital{
	background-color: #e0ecee;
	margin-bottom: 20px;
	padding: 2px 0 8px 8px;
}
#ygrp-vital #vithd{
	font-size: 77%;
	font-family: Verdana;
	font-weight: bold;
	color: #333;
	text-transform: uppercase;
}
#ygrp-vital ul{
	padding: 0;
	margin: 2px 0;
}
#ygrp-vital ul li{
  list-style-type: none;
  clear: both;
  border: 1px solid #e0ecee;  
}
#ygrp-vital ul li .ct{
  font-weight: bold;
  color: #ff7900;
  float: right;
  width: 2em;
  text-align:right;
  padding-right: .5em;
}
#ygrp-vital ul li .cat{
  font-weight: bold;
}
#ygrp-vital a {
	text-decoration: none;
}

#ygrp-vital a:hover{
  text-decoration: underline;
}

#ygrp-sponsor #hd{
	color: #999;
	font-size: 77%;
}
#ygrp-sponsor #ov{
	padding: 6px 13px;
	background-color: #e0ecee;
	margin-bottom: 20px;
}
#ygrp-sponsor #ov ul{
	padding: 0 0 0 8px;
	margin: 0;
}
#ygrp-sponsor #ov li{
	list-style-type: square;
	padding: 6px 0;
	font-size: 77%;
}
#ygrp-sponsor #ov li a{
	text-decoration: none;
	font-size: 130%;
}
#ygrp-sponsor #nc {
  background-color: #eee;
  margin-bottom: 20px;
  padding: 0 8px;
}
#ygrp-sponsor .ad{
	padding: 8px 0;
}
#ygrp-sponsor .ad #hd1{
	font-family: Arial;
	font-weight: bold;
	color: #628c2a;
	font-size: 100%;
	line-height: 122%;
}
#ygrp-sponsor .ad a{
	text-decoration: none;
}
#ygrp-sponsor .ad a:hover{
	text-decoration: underline;
}
#ygrp-sponsor .ad p{
	margin: 0;
}
o {font-size: 0; }
.MsoNormal {
   margin: 0 0 0 0;
}
#ygrp-text tt{
  font-size: 120%;
}
blockquote{margin: 0 0 0 4px;}
.replbq {margin:4}
-->
</style>
</head>
<!--~-|**|PrettyHtmlEnd|**|-~-->
</html><!--End group email -->


--1EkBfXfEH3NqVxkBBxZW3XzxUHB41tFRqSO0mwy--