echo '<g:markers>';

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
okelly
Forum Commoner
Posts: 29
Joined: Thu Feb 23, 2006 2:18 pm

echo '<g:markers>';

Post 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>';
 
mattpointblank
Forum Contributor
Posts: 304
Joined: Tue Dec 23, 2008 6:29 am

Re: echo '<g:markers>';

Post by mattpointblank »

Escape the : with a backslash?
okelly
Forum Commoner
Posts: 29
Joined: Thu Feb 23, 2006 2:18 pm

Re: echo '<g:markers>';

Post 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
Post Reply