Forum Moderators: open

Message Too Old, No Replies

XML crashes due to ampersand?

         

chornbeck

2:31 pm on May 12, 2006 (gmt 0)

10+ Year Member



Very new to XML in general, but I have a php script that generates an XML file.

THe XML file is then fed through Google Maps API to produce a map with markers plotted on it.

Sometimes the map plots the markers, sometimes it doesn't.

I was looking at the last try, which created what looked like a good XML file. It wouldn't plot. I searched the XML file and found a '&' in one of the names.

Is this the thing that's been crashing my app? Does Google Maps' parser hang when it sees this?

It's like <marker>Bob & Mary Johnson</marker>...

choster

7:01 pm on May 12, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



The ampersand is a reserved character in XML; <marker>Bob & Mary Johnson</marker> is not valid XML. You must escape it as &amp; or wrap it in order to hide it from your XML parser, e.g. <marker><![CDATA[Bob & Mary Johnson]]></marker>.