homepage Welcome to WebmasterWorld Guest from 54.166.113.249
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Home / Forums Index / Code, Content, and Presentation / XML Development
Forum Library, Charter, Moderators: httpwebwitch

XML Development Forum

    
Ampersands. HTMLencode, or CDATA?
a choice with nuances
httpwebwitch

WebmasterWorld Administrator httpwebwitch us a WebmasterWorld Top Contributor of All Time 10+ Year Member



 
Msg#: 3674323 posted 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:

this

<books>
<book title="Withnail &amp; I"/>
<book title="Griffin &amp; Sabine"/>
<book title="Love &amp; Marriage"/>
</books>

or this

<books>
<book><title><![CDATA[Withnail & I]]></title></book>
<book><title><![CDATA[Griffin & Sabine]]></title></book>
<book><title><![CDATA[Love & Marriage]]></title></book>
</books>

which would you choose?
and why?

 

Marshall

WebmasterWorld Senior Member 10+ Year Member



 
Msg#: 3674323 posted 10:31 am on Jun 14, 2008 (gmt 0)

I use the first method which works for me without any problems.

Marshall

cmarshall

WebmasterWorld Senior Member 5+ Year Member



 
Msg#: 3674323 posted 5:11 pm on Jun 17, 2008 (gmt 0)

I ditto Marshall.

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / XML Development
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved