A CDATA section can be (mostly) included as CDATA by breaking up the ]]> delimiter. For example,

<![CDATA[text & markup]]>

Can be wrapped as,

<![CDATA[<![CDATA[text & markup]]]>]>

with characters ]> outside any CDATA section as plain text. This technique will work for any sequence of mixed text and markup by escaping out of and back into CDATA sections as many times as necessary.

Bob Foster

Andy Clark wrote:
Michael Glavassevich wrote:

The sequence "]]>" [1] cannot appear in character data. You should escape the ">" with &gt;.


Actually, escaping it wouldn't do any good because the string
"&gt;" would be passed out, which is probably not intended. In
short, CDATA sections shouldn't be used if you need to include
the string "]]>" in your XML document.

But Jeff Greif has the keen eye on this one. He correctly
noticed that the start delimiter of the CDATA section is wrong.

However, Radhakrishnan J should take special care if he is
going to use CDATA sections to embed documents inside of the
main XML document. If the embedded document contains a CDATA
section (or even just the text "]]>"), then it will produce
a document that is not well-formed.

[1] http://www.w3.org/TR/2004/REC-xml-20040204/#NT-CharData



--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to