Have Format.WFST support multiple typenames, r=ahocevar (closes #1839)
git-svn-id: http://svn.openlayers.org/trunk/openlayers@10260 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
@@ -186,7 +186,14 @@ OpenLayers.Format.WFST.v1 = OpenLayers.Class(OpenLayers.Format.XML, {
|
|||||||
"xsi:schemaLocation": this.schemaLocationAttr(options)
|
"xsi:schemaLocation": this.schemaLocationAttr(options)
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
this.writeNode("Query", options, node);
|
if (typeof this.featureType == "string") {
|
||||||
|
this.writeNode("Query", options, node);
|
||||||
|
} else {
|
||||||
|
for (var i=0,len = this.featureType.length; i<len; i++) {
|
||||||
|
options.featureType = this.featureType[i];
|
||||||
|
this.writeNode("Query", options, node);
|
||||||
|
}
|
||||||
|
}
|
||||||
return node;
|
return node;
|
||||||
},
|
},
|
||||||
"Transaction": function(features) {
|
"Transaction": function(features) {
|
||||||
|
|||||||
@@ -89,6 +89,29 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function test_write_multiple(t) {
|
||||||
|
|
||||||
|
var format = new OpenLayers.Format.WFST({
|
||||||
|
featureNS: "http://www.openplans.org/topp",
|
||||||
|
featureType: ["states", "cities"],
|
||||||
|
featurePrefix: "topp",
|
||||||
|
geometryName: "the_geom"
|
||||||
|
});
|
||||||
|
|
||||||
|
t.plan(1);
|
||||||
|
var snippets = {
|
||||||
|
"GetFeatureMultiple": {}
|
||||||
|
}
|
||||||
|
|
||||||
|
var arg;
|
||||||
|
for(var snippet in snippets) {
|
||||||
|
arg = snippets[snippet]
|
||||||
|
var expected = readXML(snippet);
|
||||||
|
var got = format.writers["wfs"]["GetFeature"].apply(format, [arg]);
|
||||||
|
t.xml_eq(got, expected, snippet + " request created correctly with multiple typenames");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function readXML(id) {
|
function readXML(id) {
|
||||||
var xml = document.getElementById(id).firstChild.nodeValue;
|
var xml = document.getElementById(id).firstChild.nodeValue;
|
||||||
return new OpenLayers.Format.XML().read(xml).documentElement;
|
return new OpenLayers.Format.XML().read(xml).documentElement;
|
||||||
@@ -148,6 +171,12 @@
|
|||||||
<wfs:Query typeName="topp:states" xmlns:topp="http://www.openplans.org/topp"/>
|
<wfs:Query typeName="topp:states" xmlns:topp="http://www.openplans.org/topp"/>
|
||||||
</wfs:GetFeature>
|
</wfs:GetFeature>
|
||||||
--></div>
|
--></div>
|
||||||
|
<div id="GetFeatureMultiple"><!--
|
||||||
|
<wfs:GetFeature xmlns:wfs="http://www.opengis.net/wfs" service="WFS" version="1.0.0" xsi:schemaLocation="http://www.opengis.net/wfs http://schemas.opengis.net/wfs/1.0.0/WFS-transaction.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||||
|
<wfs:Query typeName="topp:states" xmlns:topp="http://www.openplans.org/topp"/>
|
||||||
|
<wfs:Query typeName="topp:cities" xmlns:topp="http://www.openplans.org/topp"/>
|
||||||
|
</wfs:GetFeature>
|
||||||
|
--></div>
|
||||||
<div id="Transaction"><!--
|
<div id="Transaction"><!--
|
||||||
<wfs:Transaction xmlns:wfs="http://www.opengis.net/wfs" service="WFS" version="1.0.0"/>
|
<wfs:Transaction xmlns:wfs="http://www.opengis.net/wfs" service="WFS" version="1.0.0"/>
|
||||||
--></div>
|
--></div>
|
||||||
|
|||||||
Reference in New Issue
Block a user