| Welcome to WebmasterWorld Guest from 220.127.116.11 |
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
|Pubcon Platinum Sponsor 2014|
|Ampersands. HTMLencode, or CDATA?|
a choice with nuances
| 7:08 pm on Jun 13, 2008 (gmt 0)|
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?
| 10:31 am on Jun 14, 2008 (gmt 0)|
I use the first method which works for me without any problems.
| 5:11 pm on Jun 17, 2008 (gmt 0)|
I ditto Marshall.
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