I put here about my codes to output XML file, so I don't find I had 3 lines
of whitespace before it.
<?php
$doc = domxml_new_doc("1.0");
$node = $doc->create_element("markers");
$parnode = $doc->append_child($node);
header("Content-type: text/xml");
require_once("dbconnect_ip2city.php"); // Opens a connection
to a
mySQL server
// Select all the rows in the markers table
$query = "SELECT DISTINCT all FROM guestinfor;
$result = mysql_query($query);
if (!$result) {
die('Invalid query: ' . mysql_error());
}
// Iterate through the rows, adding XML nodes for each
while ($row = @mysql_fetch_assoc($result)){
// ADD TO XML DOCUMENT NODE
$node = $doc->create_element("marker");
$newnode = $parnode->append_child($node);
$newnode->set_Attribute("country",
utf8_encode($row['countryName']));
$newnode->set_Attribute("region",
utf8_encode($row['regionName']));
$newnode->set_Attribute("city",
utf8_encode($row['cityName']));
$newnode->set_Attribute("lat", $row['latitude']);
$newnode->set_Attribute("lng", $row['longitude']);
$newnode->set_Attribute("datetime", $row['time_at']);
}
$xmlfile = $doc->dump_mem(true, "UTF-8");
echo $xmlfile;
?>
Many thanks.
2008/8/31 [EMAIL PROTECTED] <[EMAIL PROTECTED]>
>
> On Aug 30, 8:19 pm, "Ming Ming" <[EMAIL PROTECTED]> wrote:
> > Can you give me any hints? It still does not work in FireFox.
>
> I can repeat the ones I already gave you:
> Hint #1:
> >> 3. when you output a XML file, I referenced to this essay(Using PHP/
> >> MySQL with Google Maps:http://code.google.com/support/bin/answer.py?
> >> answer=65622), But I can' output XML file in FireFox. Always got this
> Error:
>
>
> >> XML Parsing Error: XML or text declaration not at start of entity
> >> Location:http://xxxxxxxxxx.php
> >> Line Number 3, Column 1:<?xml version="1.0" encoding="UTF-8"?>
> >> ^
>
> > Your XML is invalid. Fix it. Read the error. You have white space
> > before the <?xml ...?> declaration (line number 3), that is not
> > allowed.
>
> The error occurs on line 3. The xml parser requires the <?xml ...?>
> to be on the first line with no whitespace before it. You have 3 lines
> of whitespace before it. That is not allowed.
>
> Hint #2:
> follow the posting guidelines and provide a link to your map so we can
> see what is going wrong for ourselves and not waste our time guessing.
>
>
> >
> > Many thanks.
> >
> > 2008/8/30 Rossko <[EMAIL PROTECTED]>
> >
> >
> >
> > > On Aug 30, 4:00 pm, MingMingTian <[EMAIL PROTECTED]> wrote:
> > > > I just use the PHP codes to output XML in my page. No more codes.
> >
> > > Don't understand what that means...
> > > You've fixed it?
> > > You're just using someone elses PHP and don't know how to fix it?
> >
> > > cheers, Ross K
> >
> > --
> > Ming
> >
>
--
Ming
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Google Maps API" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/Google-Maps-API?hl=en
-~----------~----~----~----~------~----~------~--~---