diff --git a/lib/OpenLayers/Format/WFST/v1.js b/lib/OpenLayers/Format/WFST/v1.js
index 76ee261bd8..36c59948d8 100644
--- a/lib/OpenLayers/Format/WFST/v1.js
+++ b/lib/OpenLayers/Format/WFST/v1.js
@@ -254,9 +254,11 @@ OpenLayers.Format.WFST.v1 = OpenLayers.Class(OpenLayers.Format.XML, {
// add in attributes
for(var key in feature.attributes) {
- this.writeNode(
- "Property", {name: key, value: feature.attributes[key]}, node
- );
+ if(feature.attributes[key] !== undefined) {
+ this.writeNode(
+ "Property", {name: key, value: feature.attributes[key]}, node
+ );
+ }
}
// add feature id filter
@@ -269,7 +271,9 @@ OpenLayers.Format.WFST.v1 = OpenLayers.Class(OpenLayers.Format.XML, {
"Property": function(obj) {
var node = this.createElementNSPlus("wfs:Property");
this.writeNode("Name", obj.name, node);
- this.writeNode("Value", obj.value, node);
+ if(obj.value !== null) {
+ this.writeNode("Value", obj.value, node);
+ }
return node;
},
"Name": function(name) {
diff --git a/tests/Format/WFST/v1.html b/tests/Format/WFST/v1.html
index eb0f8cedc9..fedaf00a15 100644
--- a/tests/Format/WFST/v1.html
+++ b/tests/Format/WFST/v1.html
@@ -27,11 +27,18 @@
var feature = new OpenLayers.Feature.Vector(
new OpenLayers.Geometry.Point(1,2),
- {foo: "bar"});
+ {foo: "bar"}
+ );
var insertFeature = feature.clone();
+ // null value does not show up in insert
+ insertFeature.attributes.nul = null;
insertFeature.state = OpenLayers.State.INSERT;
var updateFeature = feature.clone();
+ // undefined value means don't create a Property element
+ updateFeature.attributes.unwritten = undefined;
+ // null value gets Property element with no Value
+ updateFeature.attributes.nul = null;
updateFeature.fid = "fid.42";
updateFeature.state = OpenLayers.State.UPDATE;
var deleteFeature = feature.clone();
@@ -144,6 +151,9 @@
foo
bar
+
+ nul
+