Hi,
today I was trying to check an issue for a user and run the following
transaction:
<wfs:Transaction service="WFS" version="1.0.0"
xmlns:wfs="http://www.opengis.net/wfs"
xmlns:topp="http://www.openplans.org/topp"
xmlns:gml="http://www.opengis.net/gml"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.opengis.net/wfs http://schemas.opengis.net/wfs/1.0.0/WFS-transaction.xsd http://www.openplans.org/topp http://localhost:8080/geoserver/wfs/DescribeFeatureType?typename=topp:sightings">
<wfs:Insert>
<topp:sightings>
<topp:description>Hey there</topp:description>
<topp:geom>
<gml:coordinates>10,10</gml:coordinates>
</topp:geom>
</topp:sightings>
</wfs:Insert>
</wfs:Transaction>
Well, it's what I wrote in the GeoServer sample requests dialog.
I did not expect it to work first time, instead
much to my surprise it did. So I checked on the db and saw that
a record was added but without the two specified fields.
Now, the above transaction is wrong in two ways:
* there is no description field in the feature type, the field
is named "species" instead
* the point specification is wrong, it should be
<topp:geom><gml:Point><gml:coordinates>...
Yet, the parser did not complain and I had to double check on the
database to notice. This is not good, since the
above document is not valid from a schema point of view...
how comes the validation is (apparently) turned off?
For the record, the describe feature type called to retrieve
the schema works and returns the following schema:
<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:gml="http://www.opengis.net/gml" xmlns:topp="http://www.openplans.org/topp" elementFormDefault="qualified" targetNamespace="http://www.openplans.org/topp">
<xsd:import namespace="http://www.opengis.net/gml" schemaLocation="http://localhost:8080/geoserver/schemas/gml/3.1.1/base/gml.xsd"/>
<xsd:complexType name="sightingsType">
<xsd:complexContent>
<xsd:extension base="gml:AbstractFeatureType">
<xsd:sequence>
<xsd:element maxOccurs="1" minOccurs="0" name="species" nillable="true" type="xsd:string"/>
<xsd:element maxOccurs="1" minOccurs="0" name="geom" nillable="true" type="gml:PointPropertyType"/>
</xsd:sequence>
</xsd:extension>
</xsd:complexContent>
</xsd:complexType>
<xsd:element name="sightings" substitutionGroup="gml:_Feature" type="topp:sightingsType"/>
</xsd:schema>
Running the same request against 1.5.4, which is using the old gml parser, returns the following error:
org.xml.sax.SAXException: Could not find attributeType named descriptionin featureType DefaultFeatureType [name=sightings , namespace=http://www.openplans.org/topp , abstract=false , types=(DefaultAttributeType [name=species , type=class java.lang.String , nillable=true, min=1, max=1],DefaultAttributeType [name=geom , type=class com.vividsolutions.jts.geom.Point , nillable=true, min=1, max=1],)]
org.xml.sax.SAXException: Could not find attributeType named descriptionin featureType DefaultFeatureType [name=sightings , namespace=http://www.openplans.org/topp , abstract=false , types=(DefaultAttributeType [name=species , type=class java.lang.String , nillable=true, min=1, max=1],DefaultAttributeType [name=geom , type=class com.vividsolutions.jts.geom.Point , nillable=true, min=1, max=1],)]
Cheers
Andrea