Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

CDATA

 
Pradeep bhatt
Ranch Hand
Posts: 8927
Firefox Browser Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry for asking a dumb question! Why do we need CDATA in XML when we can use "& lt;" and "& rt;".
 
Lasse Koskela
author
Sheriff
Posts: 11962
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That's a good question. We might manage without CDATA but I still think it's useful. Consider a large text block containing hundreds and hundreds of special characters you need to encode as an entity reference. Without CDATA, you would need to do a lot more string manipulation compared to using CDATA. With CDATA, you only need to encode the ]]> into [[>
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic