O'Reilly logo

Effective XML: 50 Specific Ways to Improve Your XML by Elliotte Rusty Harold

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

CDATA Sections

CDATA sections are probably the most frequently abused drugs in the XML pharmacy. The normal reason for this abuse is to embed non-well-formed HTML inside an XML document. For example, the description element in a catalog entry might contain an entire web page for a product.

 <Vehicle> <price>30000</price> <inStock>4</inStock> <color>black</color> <description><![CDATA[ <html> <title>The G2 SUV</title> <body> <img src=g2suv.jpg height=100 width=100> The G2 SUV is one of our best-selling models. <p> It's built on a truck base for all the stability of a pickup driving down a bumpy country road. <p> It gets an astonishing eight miles to the liter. <p> <hr> <a href=G3SUV.html>Next Car</a> </body> </HTML> ]]></description> </Vehicle> ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required