Page 1 of 1

echo '<g:markers>';

Posted: Sun Feb 08, 2009 5:45 pm
by okelly
Hello guys
I'm trying to manually parse <g:markers> tags below. I'm sure its reasonably simple but its doing my nut in. The ISO Latin 1 encoding for ":" is &#58;
I've tried the simple line below but my php script wont parse the ":"

Code: Select all

echo '<g:markers>';

I've tried also the following but the script wont parse the ":" either

Code: Select all

echo '<g&#58;markers>' ;
The code snippet is attached below .The rest of the code works ok , when I leave out the ":"

Can somebody oblige me? Thanks

Code: Select all

 
header("Content-type: text/xml");
// Start XML file, echo parent node
// the mySql connection string is not shown here but works ok
// I've tried using encoding =UTF8 but doesnt work either
echo '<?xml version="1.0" encoding="ISO-8859-1"?>';
echo '<g:markers>';
// Iterate through the rows, printing XML nodes for each
while ($row = @mysql_fetch_assoc($result)){
 // ADD TO XML DOCUMENT NODE
  echo '<marker ';
  echo 'country="' . $row['country'] . '" ';
  echo 'lat="' . $row['lat'] . '" ';
  echo 'lng="' . $row['lng'] . '" ';
  echo '/>'; }
// End XML file
echo '</g:markers>';
 

Re: echo '<g:markers>';

Posted: Mon Feb 09, 2009 3:18 am
by mattpointblank
Escape the : with a backslash?

Re: echo '<g:markers>';

Posted: Mon Feb 09, 2009 9:02 am
by okelly
thanks mattpointblank.

It wasn't immediately apparent, but after running the output via the w3c XML validator , I found out that the "g:" was an undeclared namespace.
After declaring the g: namespace the output worked fine...

I'm a little wiser now!
cheers