Rules for DataArray, Matrix and DataStream

SWE Common Data Model OGC 08-094r1 Requirement http:www.opengis.netspecSWE2.0reqxml-encoding-rulesarray-wrapper-elt-valid Req 100. All elements of each nested “DataArray” and “Matrix” shall be encapsulated in a parent element as specified in Req 94 and this element shall also have an “elementCount” attribute that specifies the array size. The following example builds on the sample profile series dataset introduced in clause 9.2.6 and shows how the same values could be encoded with the “XMLEncoding” method: swe:encoding swe:XMLEncoding swe:encoding swe:values xmlns:ns = urn:myorg:dataset:PS3658 ns:profileData ns:time 2005-05-16T21:47:12Z ns:time ns:profilePoints elementCount = 5 ns:point ns:depth ns:depth ns:salinity 45 ns:salinity ns:point ns:point ns:depth 10 ns:depth ns:salinity 20 ns:salinity ns:point ns:point ns:depth 20 ns:depth ns:salinity 30 ns:salinity ns:point ns:profilePoint ns:depth 30 ns:depth ns:salinity 35 ns:salinity ns:point ns:profilePoint ns:depth 40 ns:depth ns:salinity 40 ns:salinity ns:point ns:profilePoints ns:profileData ns:profileData ns:time 2005-05-16T22:43:05Z ns:time ns:profilePoints elementCount = 4 ns:point ns:depth ns:depth ns:salinity 45 ns:salinity ns:point ns:point ns:depth 10 ns:depth ns:salinity 20 ns:salinity ns:point ns:point ns:depth 20 ns:depth ns:salinity 30 ns:salinity ns:point ns:point ns:depth 30 ns:depth ns:salinity 35 ns:salinity ns:point ns:profilePoints ns:profileData swe:values Copyright © 2011 Open Geospatial Consortium 131 OGC 08-094r1 SWE Common Data Model This example shows how the array size is specified on the ‘profilePoints’ element corresponding to each nested array, and how element local names correspond to the “name” attributes of each component’s parent property.

9.3.6 MIME Media Types

When array or stream values are encoded with the XML encoding method and provided standalone i.e. outside of any wrapper format, the textxml or applicationxml identifiers shall be used whenever media type information is needed by the application. Note however that the textxml media type is not always appropriate when some of the characters in the data stream are encoded with a different character set than US-ASCII. Please read the relevant IETF standards for details. 132 Copyright © 2011 Open Geospatial Consortium SWE Common Data Model OGC 08-094r1

9.4 Requirements Class: Binary Encoding Rules Requirements Class

http:www.opengis.netspecSWE2.0reqbinary-encoding-rules Target Type Encoded Values Instance Dependency http:www.opengis.netspecSWE2.0requml-advanced-encodings Dependency http:www.opengis.netspecSWE2.0reqgeneral-encoding-rules The “BinaryEncoding” method encodes field values by their binary representation. The ABNF syntax defined in IETF RFC 5234 is used to formalize the encoding rules, and thus all ABNF snippets provided in this section are normative. Requirement http:www.opengis.netspecSWE2.0reqbinary-encoding-rulesabnf-syntax-valid Req 101. The encoded values block shall be formatted as defined by the ABNF grammar defined in this clause. The encoding rules are similar to those of the “TextEncoding” method except that numerical values are encoded directly as their binary representation and that no separators are used. Separators are not needed because data types have either a fixed size or contain length information See String encoding.

9.4.1 Rules for Scalar Components

The value for a scalar component is encoded as its binary representation. This especially applies to numerical values that are encoded directly in binary form in accordance to the selected data type and the value of the “byteOrder” attribute. scalar-value = binary value encoded according to data type, byte encoding and byte order specifications The last column of Table 8.1 in clause 8.6.1 indicates how each data type shall be binary encoded into a low level byte sequence. The actual order of bytes composing a multi- bytes data type depends on the value of the “byteOrder” attribute. The ‘bigEndian’ option indicates that muti-bytes data types are encoded with the most significant byte MSB first, while selecting ‘littleEndian’ signifies that encoding is done with the less significant byte LSB first. A UTF-8 string is not considered as a multi-byte data type and is always encoded in the same order, as specified by the Unicode Standard. Copyright © 2011 Open Geospatial Consortium 133