Expand on a patch by Edgemaster to support non-XML vector formats via the

current XML layer. This patch rearranges the reading of the document from XML
so that it is done later on, building on the work in #1575. It also adds tests
for the two cases that aren't currently tested: 

 * Vector Mode with non-XML format
 * non-vectormode with XML DOM passed in

Tests continue to pass, confirmed via manual inspection as well as the tests.

(Closes #1575) 


git-svn-id: http://svn.openlayers.org/trunk/openlayers@7416 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
crschmidt
2008-06-21 14:23:33 +00:00
parent 45b87bc02d
commit b8d81e7917
2 changed files with 44 additions and 4 deletions

View File

@@ -133,13 +133,17 @@ OpenLayers.Tile.WFS = OpenLayers.Class(OpenLayers.Tile, {
if (this.features) {
var doc = request.responseXML;
if (!doc || !doc.documentElement) {
doc = OpenLayers.Format.XML.prototype.read(request.responseText);
doc = request.responseText;
}
if (this.layer.vectorMode) {
this.layer.addFeatures(this.layer.formatObject.read(doc));
} else {
var resultFeatures = OpenLayers.Ajax.getElementsByTagNameNS(
doc, "http://www.opengis.net/gml", "gml", "featureMember"
var xml = new OpenLayers.Format.XML();
if (typeof doc == "string") {
doc = xml.read(doc);
}
var resultFeatures = xml.getElementsByTagNameNS(
doc, "http://www.opengis.net/gml", "featureMember"
);
this.addResults(resultFeatures);
}