Hi
Can any one tell me what is the use of CDATA in xml......................?
Loading
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend4days leftRegister
VulpesRank #55 · 29.2K reputationPosted Aug 9, 2011, 11:51 PM EDT
Zoran HorvatRank #792 · 2.9K reputationPosted Aug 9, 2011, 11:53 PM EDT
CDATA is used to transfer bulk data as part of XML document - for example, base64-encoded JPEG image and similar data. In such cases XML is normally formed, like having image name, dimensions and other properly formatted data as elements and attributes. And once things come to actually adding the image into XML, you just open CDATA block and pour the data into it.
Hope this explains. Only one more addition - text contained in CDATA should not be HTML encoded, since it is not treated by XML parser and consequently will not be decoded. It means that you're free to write <, > and other characters in CDATA. You can use it to contain raw HTML or XML if you like - it will all be ignored by the parser all until ]]> is reached.
Zoran
Smart LuckyRank #2,625 · 531 reputationPosted Aug 10, 2011, 12:02 AM EDT
can you send me an example please...?
Zoran HorvatRank #792 · 2.9K reputationPosted Aug 10, 2011, 12:06 AM EDT
http://www.w3schools.com/xml/xml_cdata.asp
VulpesRank #55 · 29.2K reputationPosted Aug 10, 2011, 12:18 AM EDT
http://en.wikipedia.org/wiki/CDATA