Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Ampersand breaks my XML from loading with jQuery

Tags:

jquery

ajax

xml

I have descriptions being displayed within an XML document and then loading it into an application with jQuery.

When I try to use '&' it breaks the code from loading. I've also tried

&

and it doesn't work either.

Is there a work around that will let me contain '&' symbols within my XML?

edit: Structure is...

<picture title="Name" description="A picture of Adam & Eve"></picture>
like image 938
Philip Kirkbride Avatar asked Dec 27 '22 23:12

Philip Kirkbride


1 Answers

You can use &amp;. The xml parser treats & as the start of a character entity...and & by itself is not a valid character entity.

<picture title="Name" description="A picture of Adam &amp; Eve"></picture>
like image 136
dotjoe Avatar answered Dec 29 '22 13:12

dotjoe