| Welcome to WebmasterWorld Guest from 220.127.116.11 |
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
|Pubcon Gold Sponsor 2015! |
|Ampersands. HTMLencode, or CDATA?|
a choice with nuances
CDATA in attributes is forbidden.
Ampersands in attributes are forbidden.
Ampersands anywhere except CDATA are forbidden.
So if I have data that potentially contains an ampersand, I have two options:
<book title="Withnail & I"/>
<book title="Griffin & Sabine"/>
<book title="Love & Marriage"/>
<book><title><![CDATA[Withnail & I]]></title></book>
<book><title><![CDATA[Griffin & Sabine]]></title></book>
<book><title><![CDATA[Love & Marriage]]></title></book>
which would you choose?
All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved