title: how to fix this error XML Parsing Error: not well-formed
body: <p>i am using PHP &amp; MYSQL on WordPress where i ma trying to add a Google map to my site with markers that are stored in MYSQL database.</p>
  
  <p>i am trying to retrieve the selected data using <strong>$wpdb class</strong>  and using <strong>DOM</strong> .</p>
  
  <p>but the system display this error:</p>
  
  <pre><code>XML Parsing Error: not well-formed
  Location: http://127.0.0.1/wordpress/?page_id=105&amp;preview=true
  Line Number 13, Column 15:      if ( query &amp;&amp; query.indexOf( 'preview=true' ) !== -1 ) {
  ----------------------------^
  </code></pre>
  
  <p>where is the error in my code ?
  i did not understand how to fix this XML error.</p>
  
  <h1>code:</h1>
  
  <pre><code>&lt;?php
          /*
          Template Name: MAP2
          */
  
          get_header();
    ?&gt;
  &lt;?php
  global $wpdb;
  // Get parameters from URL
  $center_lat = $_GET["lat"];
  $center_lng = $_GET["lng"];
  // Start XML file, create parent node
  $dom = new DOMDocument("1.0");  
  $node = $dom-&gt;createElement("markers");
  $parnode = $dom-&gt;appendChild($node);
  
  
  
  // Search the rows in the site_coordinates table
  $query = $wpdb-&gt;get_results("select * from site_coordinates");
  
  
  header("Content-type: text/xml");
  
  // Iterate through the rows, adding XML nodes for each
  foreach ($query as $result){
    $node = $dom-&gt;createElement("marker");
    $newnode = $parnode-&gt;appendChild($node);
    $newnode-&gt;setAttribute("site id", $row['siteID']);
    $newnode-&gt;setAttribute("lat", $row['latitude']);
    $newnode-&gt;setAttribute("lng", $row['longitude']);
  
  }
  
  echo $dom-&gt;saveXML();
  
  
  
  ?&gt;
  
  
  
  &lt;?php
  get_footer();
  ?&gt;
  </code></pre>