• Post Reply Bookmark Topic Watch Topic
  • New Topic

CDATA[]  RSS feed

 
Richard Butterwood
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why wouldn't I use CDATA[] all the time, rather than escaping every <,>,&,',"?

Is there a downside to using CDATA?

Thanks!
 
Paul Clapham
Sheriff
Posts: 22185
38
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you're writing your own XML instead of using the classes built into Java, then why not indeed?

If you have a lot of small text nodes then using CDATA would make your file larger, but then that's just life in the XML world anyway. Just make sure you watch out for the string that can't occur inside CDATA (something like ]]> but maybe not exactly that).
 
Richard Butterwood
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Paul,

Thank you for the reply. I will be consumer of this xml file, receving it in Java. The xml file will be built by another system.

I will pass your comments onto the other team.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!