Hi All, We have a requirement wherein we need to have nested CDATA in one of our xml messages. I know that this is not possible according to XML specification but there must be someway we can do it? I found a probable solution which splits a CDATA section in twop by using ]]]]><![CDATA[> in place of ]]>. But is there any other way apart from this?
Originally posted by Nick Bhatt: I know that this is not possible according to XML specification but there must be someway we can do it?
The first part is correct, the XML specification doesn't permit nested CDATA sections. Given that, I don't understand the second part of that sentence.
However you could try clarifying the requirements. You might find they don't really require nested CDATA sections; if they do, you're going to have to redesign.
I can't imagine what real-life situation would cause such a requirement. And if your probable implementation is just using two adjacent CDATA sections (which is perfectly reasonable in XML) then it's possible you misunderstood the requirement. Would you like to post more information about the actual requirement?
I don't see how it disputes that. The text inside which looks like a CDATA section is just text. It happens to look like a CDATA section, and the way you constructed the node accidentally produces two adjacent CDATA sections which end up evaluating to that text.
So I wouldn't call that "nested CDATA sections". That's why I originally said that I couldn't imagine what nested CDATA sections would look like and asked what the actual requirements were. I expect the requirements went away upon reexamination because we never heard any more from Nick Bhatt.