Introduction
This page describes the notation that is used for all string
based data structures using in the NavWin MVP system. The notation and
characters have been carefully selected to allow data to be compactly stored,
sent and parsed by JavaScript.
Notation Elements
The following syntax is used:
<x> means x is some item in the system
{<x>} means zero or more item x in the system
[<x>] means the element is optional. It is a single
occurrence
<x>| <y> means either <x> or <y> but
not both
@ is the literal character ‘@’ a field separator
+ is the literal character ‘+’ and it is an object separator
Special Character Replacements
If the element <x> has any of the following embedded
characters ‘\’, ‘@’ or ‘+’ then when they are stored, in general, they are directly
replaced as follows:
‘\’ becomes ‘\1’
‘@’ becomes ‘\2’
‘+’ becomes ‘\3’
When they are read, the reverse transformation is done.
Currently there are no other special characters.
Usage of @ and + separators
The special characters ‘@’ and ‘+’ are used to split the
message up quickly using String.Split(‘@’) and String.Split(‘+’) notation to
convert the string into an array of strings. This works in both C# and
JavaScript.
We use ‘@’ as an inner separator and ‘+’ as an outer
separator and this can be loosely interpreted as @ is a field separator and +
is an object separator. For example:
Message = “ABD+123@456+MNO@PQR@STU“
On the outer level we can say
OuterMessages = Message.Split(“+”)
To give@
OuterMessages[0] = “ABC”
OuterMessages[1]= “123@456”
OuterMessages[2]= “MNO@PQR@STU”
Now, when we want to process the outer message[2] we can do
this
InnerMessage = OuterMessage[2].Split(“@”)
To give
OuterMessages[0] = “MNO”
OuterMessages[1]= “PQR”
OuterMessages[2]= “STU”
Data Types
Although all data is just strings, we assume the following
formats for certain types of data as follows.
·
It the data is numeric, then we only use the decimal point
notation and no commas e.g. 123456.12 is ok. 123456,12 (European notation) is
invalid. 123,456.12 (grouping) is invalid
·
If the data is a date or time we use yyyymmdd, or hhmiss, or
yyyymmddhhmiss where yyyy is the year, mm is the month, dd is the day, hh is 24
hour format hours, mi is minutes, ss is seconds.
·
Booleans are encodes as 0 for false and 1 for true.
·
Strings should not be enclosed in quotes.