Altova Mailing List Archives>Archive Index >microsoft.public.xml Archive Home >Recent entries >Thread Prev - Re: CDATA vs Escaping XML Characters [Thread Next] Re: CDATA vs Escaping XML CharactersTo: NULL Date: 6/2/2006 10:02:00 AM "Julian F. Reschke" <julian.reschke@n...> wrote in message news:ur7dtmhhGHA.4404@T...... > sudhakarnraju@g... schrieb: > > Hi, > > There's a need to generate xml documents in our project and in one of > > the node, it can contain some snippets of code which can have <, > and > > other xml symbols > > e.g > > <Code> > > If i > 100 && j < 200 > > ... > > End If > > </Code> > > > > Question is: Should I XMLEncode the node text ( <, > etc) OR > > should I put them in CDATA attrib. > > > > Is there a difference between usage of the above 2 options. I beleive > > they are part of same XML standard and are interoperable. Please confirm > > Confirmed. > > Hint: unless human readability of the XML is a major concern, I'd avoid > CDATA altogether. It's just not needed and adds potential complexity > (escaping of "]]>"...). > I think that depends on how the XML document is created. If some form of text editor is being used then in this case I would use CDATA as a matter of course even if the current source snippet would be safe without one at this time. If the XML is machine generated then we can be confident that appropriate entities are put in place of < and & so there is no need for CDATA. Having said that since CDATA is appropriate for this sort of content and not personnaly ever having come across an example of a problem with the ]]> terminator I'd still use a CDATA section. | ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
