code: function(filter, name) {
          var node = this.createElementNSPlus("ogc:"+name);
          this.writeNode("PropertyName", filter, node);
          if(filter.value instanceof OpenLayers.Filter.Function) {
              this.writeNode("Function", filter.value, node);
          } else {
          var child;
          if(filter.value instanceof OpenLayers.Geometry) {
              child = this.writeNode("feature:_geometry", filter.value).firstChild;
          } else {
              child = this.writeNode("gml:Box", filter.value);
          }
          if(filter.projection) {
              child.setAttribute("srsName", filter.projection);
          }
          node.appendChild(child);
          }
          return node;
      }
docs: Method: writeSpatial
  
  Read a {<OpenLayers.Filter.Spatial>} filter and converts it into XML.
  
  Parameters:
  filter - {<OpenLayers.Filter.Spatial>} The filter.
  name - {String} Name of the generated XML element.
  
  Returns:
  {DOMElement} The created XML element.