title: XML Extra content at the end of the document (Using PHP SimpleXML)
body: <p>I want to create a app for search properties with zip code of corresponding areas and locate them on google map.I am testing Google's tutorial to use Maps with PHP/MySql but stuck in XML. 
  Its giving me this error:-
  This page contains the following errors:</p>
  
  <p>error on line 2 at column 1: Extra content at the end of the document
  Below is a rendering of the page up to the first error.</p>
  
  <p>This is the Code:  </p>
  
  <pre><code>    &lt;?php
  $username="root";
  $password="";
  $database="test";
  
  // Start XML file, create parent node
  $dom = new DOMDocument("1.0");
  $node = $dom-&gt;createElement("markers");
  $parnode = $dom-&gt;appendChild($node);
  
  
  // Opens a connection to a MySQL server
  $connection=mysql_connect ('localhost', $username, $password);
  if (!$connection) {
    die('Not connected : ' . mysql_error());
  }
  
  // Set the active MySQL database
  $db_selected = mysql_select_db($database, $connection);
  if (!$db_selected) {
    die ('Can\'t use db : ' . mysql_error());
  }
  
  // Select all the rows in the markers table
  $query = "SELECT * FROM markers";
  $result = mysql_query($query);
  if (!$result) {
    die('Invalid query: ' . mysql_error());
  }
  
  header("Content-type: text/xml");
  
  
  // Iterate through the rows, adding XML nodes for each
  while ($row = @mysql_fetch_assoc($result)){
    // ADD TO XML DOCUMENT NODE
    $node = $dom-&gt;createElement("marker");
    $newnode = $parnode-&gt;appendChild($node);
    $newnode-&gt;setAttribute("name", $row['name']);
    $newnode-&gt;setAttribute("address", $row['address']);
    $newnode-&gt;setAttribute("lat", $row['lat']);
    $newnode-&gt;setAttribute("lng", $row['lng']);
    $newnode-&gt;setAttribute("distance", $row['distance']);
  }
  
  $smd=$dom-&gt;saveXML();
  echo $smd;
  
  ?&gt;
  </code></pre>