为谷歌地图煽动创建XML文件

i am trying to create XML file but got error. enter image description here

i want XML file out display on page or create XML into a path. but i got these error.

<?php
function parseToXML($htmlStr)
{
$xmlStr=str_replace('<','&lt;',$htmlStr);
$xmlStr=str_replace('>','&gt;',$xmlStr);
$xmlStr=str_replace('"','&quot;',$xmlStr);
$xmlStr=str_replace("'",'&#39;',$xmlStr);
$xmlStr=str_replace("&",'&amp;',$xmlStr);
return $xmlStr;
}


    $host = ""; // hostname
    $username = ''; // username
    $psswrd = ''; // pass
    $db = ''; // database
    $dbc = mysqli_connect($host, $username, $psswrd, $db);

    if(!mysqli_connect_errno() ) {
        echo 'sueccess'; } else { 
        die("Database failed: " . 
        mysqli_connect_error() .
        " ( " . mysqli_connect_errno() . " )"
        );

    }


$query = "SELECT * FROM pace_hse_flra_hazards_content WHERE lat !='' AND lng !=''";

 $result = mysqli_query($dbc, $query);
if (!$result) {
  die('Invalid query: ' . mysqli_error());
}

header("Content-type: text/xml");

// Start XML file, echo parent node
echo "<?xml version='1.0' ?>";
echo '<markers>';
$ind=0;
// Iterate through the rows, printing XML nodes for each
while ($row = @mysqli_fetch_assoc($result)){
  // Add to XML document node
  echo '<marker ';
  echo 'id="' . $row['hazardsId'] . '" ';
 // echo 'name="' . parseToXML($row['name']) . '" ';
  echo 'address="' . parseToXML($row['geoLocation']) . '" ';
  echo 'lat="' . $row['lat'] . '" ';
  echo 'lng="' . $row['lng'] . '" ';
  //echo 'type="' . $row['type'] . '" ';
  echo '/>';
  $ind = $ind + 1;
}
// End XML file
echo '</markers>';

?>

This page contains the following errors: error on line 1 at column 1: Document is empty Below is a rendering of the page up to the first error.