SWE Common Data Model OGC 08-094r1
9.3 Requirements Class: XML Encoding rules Requirements Class
http:www.opengis.netspecSWE2.0reqxml-encoding-rules
Target Type Encoded Values Instance
Dependency
http:www.opengis.netspecSWE2.0requml-simple-encodings
Dependency
http:www.opengis.netspecSWE2.0reqgeneral-encoding-rules
The “XMLEncoding” method encodes field values by their text representation according to XML schema data type definitions and wraps them with XML tags carrying the name
of the corresponding field. The hierarchy of components is fully represented by XML tags, which makes this encoding more verbose but also well suited for processing and
validation with existing XML frameworks.
9.3.1 XML element names
Each data component of the tree is represented by an XML element whose local name corresponds to the “name” attribute of the soft-typed property containing the component
description. This property is most often “field”, “coordinate” or “elementType”, depending on the parent aggregate.
Requirement
http:www.opengis.netspecSWE2.0reqxml-encoding-ruleslocal-names-valid
Req 94. All data components shall be XML encoded with an element whose local
name shall correspond to the “name” attribute of the soft‐typed property
containing the data component.
Scalar components are thus encoded by an XML element with a text value whereas aggregate components are encoded by an XML element itself containing sub-elements
representing the aggregate’s children. The namespace URI and namespace prefix can be freely defined by the application but it is recommended that they are different from the
namespace defined in this standard.
9.3.2 Rules for Scalar Components
Scalar components are encoded by an XML element whose name corresponds to the soft- typed property containing the component.
Copyright © 2011 Open Geospatial Consortium
127
OGC 08-094r1 SWE Common Data Model
Requirement
http:www.opengis.netspecSWE2.0reqxml-encoding-rulesscalar-encoding-elt-valid
Req 95. Scalar components values shall be XML encoded with a single element
containing the value as its text content and no other child element.
Examples of scalar values encoded in XML are given below:
ns:status OFF
ns:status ns:time
2009-01-02T23:45:12Z ns:time
ns:temp 25.5
ns:temp
NIL values are included as the text content of the XML element representing scalar components, in the same way regular scalar values would be included.
9.3.3 Rules for Range Components
Range components are encoded by an XML element whose name corresponds to the soft- typed property containing the component which itself contain two minmax elements
carrying the range extreme values.
Requirement
http:www.opengis.netspecSWE2.0reqxml-encoding-rulesrange-encoding-elt-valid
Req 96. Range components values shall be XML encoded with an element
containing two sub‐elements with local names “min” and “max” which respectively
contain the lower and upper values of the range as their text content.
Let us consider the example of “TimeRange” below:
swe:field name
= SurveyPeriod
swe:TimeRange definition
= http:www.opengis.netdefpropertyEO0SurveyPeriod
referenceFrame =”…”
swe:uom xlink:href
= http:www.opengis.netdefuomISO-86010Gregorian
swe:TimeRange swe:field
Following Req 96, this component values are encoded as XML as shown below:
ns:SurveyPeriod ns:min
2009-01-02T23:45:12Z ns:min
ns:max 2009-01-02T23:45:12Z
ns:max ns:SurveyPeriod
128
Copyright © 2011 Open Geospatial Consortium