From 528055330612814307796947ae4d0135d6d90f50 Mon Sep 17 00:00:00 2001 From: crschmidt Date: Fri, 6 Oct 2006 15:33:33 +0000 Subject: [PATCH] IE, Safari, and Firefox all deal with XML elements with namespaces in different ways. I can't even make thigns work in *two* browsers at once -- what a pain. So, we'll wrap up all the browser-specific stuff in OpenLayers.Ajax.getElementsByTagNameNS(), which contains the browser funkies, and as a benefit, we get working WFS in IE. git-svn-id: http://svn.openlayers.org/trunk/openlayers@1650 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf --- lib/OpenLayers/Ajax.js | 5 +++++ lib/OpenLayers/Feature/WFS.js | 4 ++-- lib/OpenLayers/Tile/WFS.js | 3 +-- lib/OpenLayers/Util.js | 2 ++ 4 files changed, 10 insertions(+), 4 deletions(-) diff --git a/lib/OpenLayers/Ajax.js b/lib/OpenLayers/Ajax.js index 9cda5cdcb7..0cb5526b05 100644 --- a/lib/OpenLayers/Ajax.js +++ b/lib/OpenLayers/Ajax.js @@ -300,3 +300,8 @@ OpenLayers.Ajax.Request.prototype = OpenLayers.Util.extend(new OpenLayers.Ajax.B } }); +OpenLayers.Ajax.getElementsByTagNameNS = function(parentnode, nsuri, nsprefix, tagname) { + return parentnode.getElementsByTagNameNS ? + parentnode.getElementsByTagNameNS(nsuri, tagname) + : parentnode.getElementsByTagName(nsprefix + ':' + tagname); +} diff --git a/lib/OpenLayers/Feature/WFS.js b/lib/OpenLayers/Feature/WFS.js index 26f2bea931..1821915104 100644 --- a/lib/OpenLayers/Feature/WFS.js +++ b/lib/OpenLayers/Feature/WFS.js @@ -47,8 +47,8 @@ OpenLayers.Feature.WFS.prototype = processXMLNode: function(xmlNode) { //this should be overridden by subclasses // must return an Object with 'id' and 'lonlat' values set - var point = xmlNode.getElementsByTagName("Point"); - var text = OpenLayers.Util.getXmlNodeValue(point[0].getElementsByTagName("coordinates")[0]); + var point = OpenLayers.Ajax.getElementsByTagNameNS(xmlNode, "http://www.opengis.net/gml", "gml", "Point"); + var text = OpenLayers.Util.getXmlNodeValue(OpenLayers.Ajax.getElementsByTagNameNS(point[0], "http://www.opengis.net/gml","gml", "coordinates")[0]); var floats = text.split(","); return {lonlat: new OpenLayers.LonLat(parseFloat(floats[0]), parseFloat(floats[1])), diff --git a/lib/OpenLayers/Tile/WFS.js b/lib/OpenLayers/Tile/WFS.js index 26d8a40d22..46140bce22 100644 --- a/lib/OpenLayers/Tile/WFS.js +++ b/lib/OpenLayers/Tile/WFS.js @@ -101,8 +101,7 @@ OpenLayers.Tile.WFS.prototype = doc = OpenLayers.parseXMLString(request.responseText); } - var resultFeatures = doc.getElementsByTagName("featureMember"); - + var resultFeatures = OpenLayers.Ajax.getElementsByTagNameNS(doc, "http://www.opengis.net/gml","gml", "featureMember"); this.addResults(resultFeatures); }, diff --git a/lib/OpenLayers/Util.js b/lib/OpenLayers/Util.js index 74a8a4df69..45340bd797 100644 --- a/lib/OpenLayers/Util.js +++ b/lib/OpenLayers/Util.js @@ -482,6 +482,8 @@ OpenLayers.Util.getXmlNodeValue = function(node) { val = node.text; if (!val) val = node.textContent; + if (!val) + val = node.firstChild.nodeValue; }, function() { val = node.textContent;