TextEncoding Class Requirements Class: Simple Encodings Package Requirements Class

OGC 08-094r1 SWE Common Data Model say the structure defined by the “elementType” property. Stream or array data can then be composed of several blocks of the same type separated by block separator characters. The “decimalSeparator” attribute specifies the character used as the decimal point in decimal number. This attribute is optional and the default is a period ‘.’. Example In the case of a “DataStream” with an element type that is a “DataRecord” containing three fields – one of type “Category” and two of type “Quantity” - a data stream encoded using the Text method would look like the following: STATUS_OK,24.5,1022.5« STATUS_OK,24.5,1022.5« STATUS_OK,24.5,1022.5« Where ‘,’ is the token separator and ‘« ’ carriage return is the block separator i.e. this is the CSV format. Note that there could be many more values in a single block if the data set has a large number of fields, or if it contains an array of values. The “collapseWhiteSpaces” attribute is a boolean flag used to specify if extra white spaces including line feeds, tabs, spaces and carriage returns surrounding the token and block separators should be ignored skipped when processing the stream. This is useful for encoded blocks of data that are embedded in an XML document, since formatting indenting with spaces or tabs especially is often done in XML content. This type of encoding is used when compactness is important but balanced by a desire of human readability. This type of encoding is easily readable for debugging or manual usage as well as easily imported in various spreadsheet, charting or scientific software. The main drawback of such an encoding is the impossibility of locating an error in the stream with certitude. Secondly, if only one expected value is missing, the whole block is usually lost since the parser cannot resynchronize correctly before the next block separator. This last issue can however be solved by transmitting this type of encoded stream using error resilient protocols when needed.

7.6.2 XMLEncoding Class

The “XMLEncoding” class defines a method that allows encoding structured data into a stream of nested XML tags, which names are obtained from the data structure definition. The class is shown below in UML and does not contain any attribute: AbstractEncoding «Type» XMLEncoding Figure 7.34 – XMLEncoding Class 60 Copyright © 2011 Open Geospatial Consortium SWE Common Data Model OGC 08-094r1 This encoding method is used when compactness is not an issue and a high level of readability and error detection is required. Furthermore, a data stream encoded in this way can be easily transformed and formatted using XSLT like languages. The main drawback of this method is the verbosity and high degree of redundancy of the information contained in the stream due to the repetitive XML tags. This problem can be minimized by compressing the XML data using well known techniques such as GZIP or BZIP, but such an approach may not be viable in the case of streaming e.g. real time data. Copyright © 2011 Open Geospatial Consortium 61