PHP file to output XML:

<?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;
?>

So I will get it in FireFox

"XML Parsing Error: XML or text declaration not at start of entity
Line Number 3, Column 1:<?xml version="1.0" encoding="UTF-8"?>
^"
Many thanks for you,





On Aug 28, 10:19 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]>
wrote:
> On Aug 28, 2:02 pm, MingMingTian <[EMAIL PROTECTED]> wrote:
>
> > About this issue, I have some questions:
>
> > 1. I think it can't be used  'A Form' in the HTML page to call
> >JavascriptFunctions, but can be used 'A EVENT' in the HTML
> > page. ?????
>
> Je ne comprende pas...
> You can use forms in your html page, I do it all the time.  I made a
> suggestion in your last thread about this same issue.  If you want
> help (at least from me) you will have to provide a link to your page.
>
>
>
> > 2. When I need to load lots of data(100+) using "GDownloadUrl" or
> > "XMLHttpRequest", the response time  is the  same.So What I wanna
> > know, how to improve this response time??? To compare them, [the
> > author:TDDPHPDEV had put both codes in this topic  (
> > GDownloadUrl / XMLHttpRequest -DynamicallyLoadedMapnot working in
> > IE )],
>
> > And the Google got another: GXmlHttp, You will see its examples in
> > (http://econym.googlepages.com/reference.htm#GDownloadUrl) and (The
> > AJAX Philosophy:http://econym.googlepages.com/example_map11.htm)
>
> GDownloadUrl uses that browsers implementation of XmlHttpRequest as
> does GXmlHttp, so I would expect them all to be the same...
>
>
>
> > 3. when you output a XML file, I referenced to this essay(UsingPHP/
> > 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.
>
>
>
> > Anybody can give me some ideas?
>
> You didn't like the ones you got 
> here?http://groups.google.com/group/Google-Maps-API/browse_frm/thread/8ad2...
>
> Perhaps I've given you enough...
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to