解决办法:重写openlayers 2 的 OpenLayers.Format.XML类的write方法
代码:
var _class = OpenLayers.Format.XML;var originalWriteFunction = _class.prototype.write;
var patchedWriteFunction = function()
{
var child = originalWriteFunction.apply( this, arguments );
child = child.replace(new RegExp('xmlns:NS\\d+="" NS\\d+:', 'g'), '');
return child;
}
_class.prototype.write = patchedWriteFunction;