chriz
chriz

Reputation: 1345

cdata within cdata in XML

i want to use CDATA within CDATA in XML i tried following codes, but both are showing error.

1.

 <extraScript><![CDATA[

        <subScript><![CDATA[this.value]]></subScript>

 ]]></extraScript>

2.

 <extraScript><![CDATA[

        <subScript><![CDATA[this.value]]]]><![CDATA[></subScript>

 ]]></extraScript>

i refereed this post in SO

according to that answer i tried second one but </subScript> is making problem how i can escape these part. some helps??

Upvotes: 0

Views: 857

Answers (1)

Quentin
Quentin

Reputation: 944256

You can't nest CDATA blocks.

The first ]]> will terminate the first CDATA block and then the next end tag will not be well-formed.

Use character references (&lt; et al) instead.

Upvotes: 4

Related Questions