[mapserver-users] SOS response XML validity
Kralidis,Tom [Ontario]
Tom.Kralidis at ec.gc.ca
Mon Feb 16 07:00:43 PST 2009
> I have created a mapfile to generate a SOS response
> containing data from a database. I have understood that
> mapserver supports only "flat" reporting of the database
> columns to the xml response.
>
> My problem is that I wonder whether this kind of "flat"
> response is valid or not. If I try to validate the response
> against the xml schema I get errors.
>
> How can I solve this problem of xml validity against the schema?
>
> Here are the errors:
>
> *** Error start ***
> Element <observedProperty> is not allowed under element
> <om:Observation>.
> Reason: The following elements are expected at this
> location (see below)
> <om:observedProperty>
> <om:resultQuality>
> Annotations of type 'om:ObservationType' (see below)
> Base type for Observations.
> Observation is an act ("event"), whose result is an estimate
> of the value of a property of the feature of interest.
> The observed property may be any property associated with the
> type of the feature of interest.
> The following properties are inherited from AbstractFeatureType:
> Error location: om:ObservationCollection / om:member /
> om:Observation / observedProperty
> Details
> cvc-model-group: Element <observedProperty>
> unexpected by type 'om:ObservationType' of element <om:Observation>.
> cvc-elt.5.2.1: The element <om:Observation> is not
> valid with respect to the actual type definition 'om:ObservationType'.
> *** Error end ***
>
> after modifying observedProperty ==> om:observedProperty I get another
> error:
>
> *** Error start ***
> Text 'temperature' is not allowed for element
> <om:observedProperty>. The element declaration's content type
> is 'element-only'.
> Error location: om:ObservationCollection / om:member /
> om:Observation / om:observedProperty
> Details
> cvc-complex-type.2.3: Text 'temperature' is not
> allowed for element <om:observedProperty>. The element
> declaration's content type is 'element-only'.
> cvc-elt.5.2.1: The element <om:observedProperty> is
> not valid with
> respect to the actual type definition
> 'swe:PhenomenonPropertyType'.
> *** Error end ***
>
> Here is an example response that I get from my server:
>
> <?xml version="1.0" encoding="ISO-8859-1"?>
> <om:ObservationCollection xmlns:gml="http://www.opengis.net/gml"
> xmlns:ows="http://www.opengis.net/ows/1.1"
> xmlns:swe="http://www.opengis.net/swe/1.0.1"
> xmlns:xlink="http://www.w3.org/1999/xlink"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xmlns:sos="http://www.opengis.net/sos/1.0"
> xmlns:om="http://www.opengis.net/om/1.0" gml:id="htb_offering"
> xsi:schemaLocation="http://www.opengis.net/om/1.0
> http://schemas.opengis.net/om/1.0.0/om.xsd">
> <gml:description xmlns:gml="http://www.opengis.net/gml">htb
> data</gml:description>
> <gml:name xmlns:gml="http://www.opengis.net/gml">Helsinki
> test bed data</gml:name>
> <om:member>
> <om:Observation>
> <om:samplingTime>
> <gml:TimeInstant>
> <gml:timePosition>20081127042000</gml:timePosition>
> </gml:TimeInstant>
> </om:samplingTime>
> <om:procedure xlink:href="urn:ogc:def:procedure:temperature"/>
> <om:observedProperty>temperature</om:observedProperty>
> <om:result>
> <gml:featureMember xmlns:gml="http://www.opengis.net/gml">
> <gml:temperature>
> <gml:boundedBy>
> <gml:Envelope>
> <gml:lowerCorner>25.399600 60.316000</gml:lowerCorner>
> <gml:upperCorner>25.399600 60.316000</gml:upperCorner>
> </gml:Envelope>
> </gml:boundedBy>
> <msGeometry>
> <gml:Point>
> <gml:pos>25.399600 60.316000</gml:pos>
> </gml:Point>
> </msGeometry>
> <locationid>37</locationid>
> <insertionTime>20081127042054</insertionTime>
> <latitude>60.316</latitude>
> <longitude>25.3996</longitude>
> <leveltype>altitude</leveltype>
> <levelvalue>17</levelvalue>
> <levelunit>m</levelunit>
> <version>1</version>
> <parameterName>temperature</parameterName>
> <value>-1.1</value>
> <unit>C</unit>
> <aggregationName>instant</aggregationName>
> <aggregationValue>0</aggregationValue>
> <aggregationUnit>n/a</aggregationUnit>
> <form>n/a</form>
> </gml:temperature>
> </gml:featureMember>
> </om:result>
> </om:Observation>
> </om:member>
> </om:ObservationCollection>
>
Note that we're working on validating the SOS GetObservation output (see
http://trac.osgeo.org/mapserver/ticket/2646), and what is in svn trunk
is very close to a valid XML document. We're close to having this for
5.4.
..Tom
More information about the MapServer-users
mailing list