How can I have ']]>' as a text inside CDATA in xml

N

Neeraj Agrawal

I have a text which may have character sequence ']]>' and I want to
put it inside a CDATA tag. Is it possible to encode this secquence in
the xml ?

Thanks in advance
-Neeraj
 
D

Dimitre Novatchev

I have a text which may have character sequence ']]>' and I want to
put it inside a CDATA tag. Is it possible to encode this secquence in
the xml ?

Yes -- split it in two CDATA sections, e.g.:

<a><![CDATA[A CDATA text with a ]]]]><![CDATA[> in it]]>
</a>


=====
Cheers,

Dimitre Novatchev.
http://fxsl.sourceforge.net/ -- the home of FXSL
 
J

Julian F. Reschke

Dimitre Novatchev said:
I have a text which may have character sequence ']]>' and I want to
put it inside a CDATA tag. Is it possible to encode this secquence in
the xml ?

Yes -- split it in two CDATA sections, e.g.:

<a><![CDATA[A CDATA text with a ]]]]><![CDATA[> in it]]>
</a>

Or alternatively don't put it into a CDATA section in the first place (just
escape "&" as "& a m p ;" and "<" as "& l t ;").

Julian
 
R

Richard Tobin

Dimitre Novatchev said:
Yes -- split it in two CDATA sections, e.g.:

<a><![CDATA[A CDATA text with a ]]]]><![CDATA[> in it]]>
</a>

You can regard ]]]]><![CDATA[> as an escape for ]]> if you like.

-- Richard
 

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,769
Messages
2,569,582
Members
45,057
Latest member
KetoBeezACVGummies

Latest Threads

Top