title: This page contains the following errors: creates html instead of XML
body: <p>Now i get this error. </p>
  
  <p><strong>This page contains the following errors:
  error on line 3 at column 1: Extra content at the end of the document
  Below is a rendering of the page up to the first error.</strong></p>
  
  <p>Somehow the output is rending my XML file as an HTML.
  I have double and tripled checked the Attributes, and they are correct... And i cant seem to find the error... any friends with clues ?</p>
  
  <pre><code>$dom = new DOMDocument("1.0");
  $node = $dom-&gt;createElement("markers");
  $parnode = $dom-&gt;appendChild($node);
  
      class Areas{
      private $link; 
      public function __construct(){
      $this-&gt;link = new Connection();
      $this-&gt;link = $this-&gt;link-&gt;dbConnect();
  }
  
    function fetch_area() {
      $query = $this-&gt;link-&gt;query("SELECT * FROM markers WHERE 1");  
      $query-&gt;setFetchMode(PDO::FETCH_ASSOC);
  
      header("Content-type: text/xml");
  
          while($row = $query-&gt;fetch()) {  
            $node = $dom-&gt;createElement("marker");  
            $newnode = $parnode-&gt;appendChild($node);   
            $newnode-&gt;setAttribute("name",$row['name']);
            $newnode-&gt;setAttribute("adress", $row['adress']);  
            $newnode-&gt;setAttribute("lat", $row['lat']);  
            $newnode-&gt;setAttribute("lng", $row['lng']);  
            $newnode-&gt;setAttribute("type", $row['type']);
          } 
     }
    }
  $area = new Areas();
  $area_info = $area-&gt;fetch_area(); 
  echo $dom-&gt;saveXML();
  </code></pre>