[rfc-i] CDATA, was: Fwd: New Version Notification for draft-hoffman-xml2rfc-06.txt

Paul Kyzivat pkyzivat at alum.mit.edu
Tue Apr 29 09:34:08 PDT 2014

I have had occasion to include blocks of XML as artwork in a draft.
Doing this using escaping is really unpleasant. Using CDATA helps a lot. 
But of course you can still get in trouble with ]]>. I wish there was 
some better solution for those cases, that would allow copy/paste of the 
xml source.


On 4/29/14 11:48 AM, Paul Hoffman wrote:
> On Apr 29, 2014, at 1:11 AM, Julian Reschke <julian.reschke at gmx.de> wrote:
>> People who use CDATA frequently think "anything can go in here", and it's good to warn that this is not the case.
> We don't really know what they think. :-)
>>> The solution is to break the string up, such as using multiple CDATA
>>> blocks, as in this example:
>>>      ...]]]]><![CDATA[>...
>> The IMHO better solution is not to use CDATA at all :-)
> The alternative, adding escaping, has its own issues. First, it is incompatible with copying-and-pasting from a different document or from the CLI. Second, you have to check very carefully the output of the escaping, and missing those causes errors in the document; see the last draft for an example of this.
> Proposed wording for the next draft:
> Using CDATA is not a panacea, but it does help prevent having to use escapes in places where using using escapes can cause other problems, such as difficulty of inclusion from other documents.
> --Paul Hoffman
> _______________________________________________
> rfc-interest mailing list
> rfc-interest at rfc-editor.org
> https://www.rfc-editor.org/mailman/listinfo/rfc-interest

More information about the rfc-interest mailing list