AbstractEncoding Element Requirements Class: Simple Encodings Schema Requirements Class

OGC 08-094r1 SWE Common Data Model complexContent extension base= swe:AbstractSWEType complexContent complexType This element serves as the substitution group for all XML elements that describe encoding methods in this standard or in extensions of this standard.

8.5.2 TextEncoding Element

The “TextEncoding” element is the XML schema implementation of the “TextEncoding” UML class defined in clause 7.6.1. The schema snippet for this element and its corresponding complex type is shown below: element name = TextEncoding type = swe:TextEncodingType substitutionGroup = swe:AbstractEncoding complexType name = TextEncodingType complexContent extension base = swe:AbstractEncodingType attribute name = collapseWhiteSpaces type = boolean use = optional default =true attribute name = decimalSeparator type = string use = optional default =. attribute name = tokenSeparator type = string use = required attribute name = blockSeparator type = string use = required extension complexContent complexType This element is used to specify encoding of data values in a “Delimiter Separated Values” format a generalization of CSV that is parameterized by its 4 XML attributes. The exact encoding rules to be followed are specified in clause 0. Requirement http:www.opengis.netspecSWE2.0reqxsd-simple-encodingstext-encoding-rules-applied Req 75. The encoded values block described by a “TextEncoding” element shall pass the “Text Encoding Rules” conformance test class. The following example shows a set of commonly used parameters: swe:TextEncoding tokenSeparator = , blockSeparator = The “decimalSeparator” and “collapseWhiteSpaces” attributes have been omitted to indicate that their default values should be used. This leads to a data stream where individual tokens are separated by commas i.e. the ‘,’ character, while complete blocks are separated by spaces. It can for example be used to encode coordinate tuples of “lat,lon,lat” values in a very readable manner, such as: 25.41,10.23,320 25.43,10.23,300 25.39,11.51,310 106 Copyright © 2011 Open Geospatial Consortium SWE Common Data Model OGC 08-094r1 Special characters such as carriage returns CR or line feeds LF can be used as block or token separators by using XML entities. For example new line characters are often used as block separators to cleanly separate blocks of values on successive lines: swe:TextEncoding tokenSeparator = ; blockSeparator = 10; This corresponds to the following data block format: 25.41;10.23;320 25.43;10.23;300 25.39;11.51;310 This is compatible with the CSV format and is often used for compatibility with other software. More than one character can be used as a separator in order to avoid conflicts with characters within the data values themselves. The following example shows this type of usage: swe:TextEncoding tokenSeparator = || blockSeparator = 10; This specifies the following data block format: 25.41||text with spaces||text with carriage return||{special_chars} 25.42||text with spaces||text with carriage return||{special_chars} 25.43||text with spaces||text with carriage return||{special_chars} A compliant parser can successfully parse such a data block because only sequences of characters that perfectly match the separator definition indicate the end of a token or block. Implementations are required to support sequences of characters of any length as separators but small ones i.e. 1 to 3 characters are more efficient and should be used whenever possible. Both “tokenSeparator” and “blockSeparator” can have the same value but this is not recommended as it makes the data block less readable and makes block-level resynchronizations impossible in error prone transmissions.

8.5.3 XMLEncoding Element

The “XMLEncoding” element is the XML schema implementation of the “XMLEncoding” UML class defined in clause 7.6.2. The schema snippet for this element and its corresponding complex type is shown below: element name = XMLEncoding type = swe:XMLEncodingType substitutionGroup = swe:AbstractEncoding complexType name = XMLEncodingType Copyright © 2011 Open Geospatial Consortium 107