Jump to content

SimonD

Members
  • Posts

    3
  • Joined

  • Last visited

SimonD's Achievements

Newbie

Newbie (1/7)

0

Reputation

  1. Well in the end I just removed the evaluate statement and traversed the XML structure using the getElementsByTagName and childNodes methods ... a bit more code but Safari is happy with it. Still none the wiser as to why the evaluate wouldn't work but I'm less concerned with that now.
  2. Yes, .. it is the evaluate line which is receiving the error
  3. I have some javascript which is loading an XML document and filtering the elements based on a particular attribute. The XML structure is similar to the structure below: <locations> <region name="metro" title="Metropolitan"> <location type="HQ"> <name>Head Office</name> </location> <location type="NM"> <name>North Metro</name> </location> </region> <region name="south" title="Southern region"> <location type="SR"> <name>South Regional Office</name> </location> </region> </locations> The javascript is extracting the elements for a specified region, the relevent lines of code are as follows: // 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); Now this works perfectly well in Firefox, Chrome and Opera… but does not work in Safari. When executing in Safari, the _regionList variable ends up as null with an error message "TYPE_ERR: DOM XPath Exception 52: The expression could not be converted to return the specified type" thrown and I can't figure out why. Any help and suggestions would be appreciated
×
×
  • Create New...