google maps - XML file erroring due to certain characters in strings -
i have xml file pulls database. i'm getting error on strings , url's because contains characters xml treating code , either gives syntax error or says entity not defined. there way, since data string, set xml when data in quotes, ignores code , treats text? created example marker name , url having errors. marker name has & sign , url has msa, ll, spn, , iwloc doesn't like.
<?xml version="1.0" encoding="utf-8" standalone="yes" ?> <markers> <marker name="c&o canal trail" address="" city="" state="" zip="" image="" width="" height="" lat="39.693978" lng="-78.154822" category="kml" notes="" url="https://maps.google.com/maps/ms?msid=209491726150360274926.0004e18eed520de4890e6&msa=0&ll=39.213103,-77.295685&spn=0.619262,1.540833&iwloc=0004e18eee21c28a5a313" hike_distance="" hike_trail_skill_level="" hike_points_of_interest="" camping_amenities="" camping_best_sites="" camping_notes="" /> </markers>
you need xml encode text, replace:
& & < < " " ' ' > >
it's better use library roll own code.
Comments
Post a Comment