[TinyOWS-users] error inserting feature

luca marletta lucamarle at gmail.com
Fri Nov 26 02:03:36 EST 2010


Hi Olivier, thanks for your support.

I've upgrade tinyows to svn version but is not that the problem (by
the way which package it's needed for fastcgi in debian/ubuntu and
wich the path to give in ./configure?).

I understood the trouble but not solved for now.

I derived my application from Mapgears example and I put an extension
of OpenLayers.Format.WFSDescribeFeatureType() class in Openlayers 2.9
OpenLayers.Format.WFSDescribeFeatureType_1_0_0() (that actually return
an array for feature data)
and recompiled
all works but for insert I got the problem described

so the porting of the example from Mapgears in openlayer 2.9 doesn't
works for me and I have to work around to fix.

Do you have some simple example for retrieving data and geometry, save
and insert new ones?

thanks

luca

PS here the class I added:

/**
 * @requires OpenLayers/Format/WFSDescribeFeatureType.js
 *
 * Class: OpenLayers.Format.WFSDescribeFeatureType_1_0_0
 * Read WFS DescribeFeatureType response for WFS 1.0.0
 *
 * Inherits from:
 *  - <OpenLayers.Format.WFSDescribeFeatureType>
 */
OpenLayers.Format.WFSDescribeFeatureType_1_0_0 = OpenLayers.Class(
    OpenLayers.Format.WFSDescribeFeatureType, {

    /**
     * Property: xsdns
     * Namespace used for xsd.
     */
    xsdns: "http://www.w3.org/2001/XMLSchema",

    /**
     * Constructor: OpenLayers.Format.WFSDescribeFeatureType
     * Create a new parser for WFS DescribeFeatureType responses.
     *
     * Parameters:
     * options - {Object} An optional object whose properties will be set on
     *     this instance.
     */
    initialize: function(options) {
        OpenLayers.Format.WFSDescribeFeatureType.prototype.initialize.apply(this,
            [options]);
    },

    /**
     * Method: read
     * Read WFS DescribeFeatureType data from a string, return the response.
     *
     * Parameters:
     * data - {String} or {DOMElement} data to read/parse.
     *
     * Returns:
     * {Array(<DescribeFeatureType>)}
     *
     *   DescribeFeatureType: {Object} with parameters:
     *     geometry - {String} name of the geometry attribute
     *     geometrytype - {String} type of geometry (e.g. Polygon, Point,
     *                             LineString, MultiPoint)
     *     items - {Array({Items})
     *
     *     Items: {Object} with the following parameters:
     *       name - {String} attribute name
     *       type - {String} attributes types, like xsd:string
     */
    read: function(data) {
        if(typeof data == "string") {
            data = OpenLayers.Format.XML.prototype.read.apply(this, [data]);
        }
        var result = [];
        var root = data.documentElement;
        var complexTypes = this.getElementsByTagNameNS(root, this.xsdns,
            'complexType');
        for (var iterator = 0; iterator < complexTypes.length; iterator++) {
            var describefeaturetype = {};
            describefeaturetype.items = [];
            var sequence =
this.getElementsByTagNameNS(complexTypes[iterator], this.xsdns,
                'sequence');
            if (sequence.length > 0) {
                var elements =
this.getElementsByTagNameNS(sequence[0], this.xsdns,
                    'element');
                for(var i = 0; i < elements.length; ++i) {
                    var element = elements[i];
                    var name = element.getAttribute('name');
                    var type = element.getAttribute('type');
                    // if we cannot find it, assume string for now, we dont do
                    // much with this info anyway now
                    if (!type) {
                        type = 'xs:string';
                    }
                    // look for the geometry attribute
                    if (type.indexOf('gml:') >= 0) {
                        describefeaturetype.geometry = name;
                        describefeaturetype.geometrytype = type.substring(4,
                            type.indexOf('PropertyType'));
                    }
                    describefeaturetype.items.push({name: name, type: type});
                }
            }
            result.push(describefeaturetype);
        }
        return result;
    },

    CLASS_NAME: "OpenLayers.Format.WFSDescribeFeatureType_1_0_0"

});




luca marletta
www.beopen.it



On Thu, Nov 25, 2010 at 7:37 PM, Olivier Courtin
<olivier.courtin at gmail.com> wrote:
>
> On Nov 25, 2010, at 5:52 PM, luca marletta wrote:
>
> Hi Luca,
>
>> It seems that the key is in the log
>>
>> [Thu Nov 25 17:15:44 2010] [ERROR] Element '{http://127.0.0.1}rete':
>> This element is not expected.
>
> Yeap that't the point !
>
>> but what's the problem? in scheme? what version I must use?
>
> After a quick review i don't see obvious error on config files
> Could you try with SVN TinyOWS version, with same config and datas ?
>
> --
> Olivier
> _______________________________________________
> TinyOWS-users mailing list
> TinyOWS-users at lists.maptools.org
> http://lists.maptools.org/mailman/listinfo/tinyows-users
>


More information about the TinyOWS-users mailing list