]]> in cdata tags

Y

yawnmoth

How might I go about including a ]]> in a cdata tag? Since ]]>'s
normally close cdata's, ]]>, by itself, wouldn't work...
 
J

Johannes Koch

yawnmoth said:
How might I go about including a ]]> in a cdata tag? Since ]]>'s
normally close cdata's, ]]>, by itself, wouldn't work...

<![CDATA[...]]>]]><![CDATA[...]]>
 
R

Richard Tobin

yawnmoth said:
How might I go about including a ]]> in a cdata tag? Since ]]>'s
normally close cdata's, ]]>, by itself, wouldn't work...

You can't. CDATA sections are not a reliable way of escaping
arbitrary text, just a handy way of making hand-authored XML more
readable. If you need a reliable way to do it, forget CDATA and just
escape everything.

-- Richard
 
J

Joe Kesselman

Johannes said:
<![CDATA[...]]>]]><![CDATA[...]]>

Or break the sequence up across successive CDATA Sections, such as
<![CDATA[...]]]]><![CDATA[>...]]>
or
<![CDATA[...]]]><![CDATA[]>...]]>

Or, as noted, stop trying to use CDATA Sections and just escape
individual characters as needed.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,479
Members
44,899
Latest member
RodneyMcAu

Latest Threads

Top