title: javascript evaluate method fails in Safari
body: <p>I have some javascript which is loading an XML document and filtering the elements based on a particular attribute.</p>
  
  <p>The XML structure is similar to the structure below:</p>
  
  <pre><code>&lt;locations&gt;
    &lt;region name="metro" title="Metropolitan"&gt;
       &lt;location type="HQ"&gt;
          &lt;name&gt;Head Office&lt;/name&gt;
       &lt;/location&gt;
       &lt;location type="NM"&gt;
          &lt;name&gt;North Metro&lt;/name&gt;
       &lt;/location&gt;
    &lt;/region&gt; 
    &lt;region name="south" title="Southern region"&gt;
       &lt;location type="SR"&gt;
          &lt;name&gt;South Regional Office&lt;/name&gt;
       &lt;/location&gt;
    &lt;/region&gt; 
  &lt;/locations&gt; 
  </code></pre>
  
  <p>The javascript is extracting the elements for a specified region, the relevent lines of code are as follows:</p>
  
  <pre><code>// supplied region name in this case is "metro"
  var _xpath = "/locations/region[@name=\"" + regionName + "\"]";
  var _regionList;
  // code for IE .... not shown
  // code for other browsers
  _regionList = mLocationsXmlDoc.evaluate(_xpath, mLocationsXmlDoc, null, XPathResult.ANY_TYPE, null);
  </code></pre>
  
  <p>Now this works perfectly well in Firefox, Chrome and Opera… but does not work in Safari. </p>
  
  <p>When executing in Safari, the <em>_regionList</em> variable ends up as null with an error message <code>"TYPE_ERR: DOM XPath Exception 52: The expression could not be converted to return the specified type"</code> thrown and I can't figure out why.  Any help and suggestions would be appreciated.</p>