I am following this tutorial from google for google maps:
https://developers.google.com/maps/articles/phpsqlajax_v3?hl=es
I formatted my code as so:
echo '<markers>';
// Iterate through the rows, adding XML nodes for each
for($i = 0; $i< $breweryNum; $i++ ){
echo '<marker ';
echo 'name="' . parseToXML($row['beerBrewery']) . '" ';
echo 'lat="' . $row['lat'] . '" ';
echo 'lng="' . $row['longi'] . '" ';
echo '/>';
}
// End XML file
echo '</markers>';
But when I run the php file to test my xml, I get this:
XML Parsing Error: not well-formed
Location: http://beerportfolio.com/getMapMarkers.php
Line Number 1, Column 18:<markers><marker <br />
-----------------^
Are you use nl2br or some to output resulting string?
It's clear error message, after "<markers><marker
" outputs tag "<br />
" but here should be your "name" attribute. Anyway, you can use following code to not output wrong things:
$out = '<markers>';
for($i = 0; $i< $breweryNum; $i++ ){
$out .= '<marker ';
$out .= 'name="' . parseToXML($row['beerBrewery']) . '" ';
$out .= 'lat="' . $row['lat'] . '" ';
$out .= 'lng="' . $row['longi'] . '" ';
$out .= '/>';
}
$out .= '</markers>';