Text based DataEncodings such as UA XML (5.3) or UA JSON (5.4) make use of Names from the DataType and DataTypeDefinition to create the serialized data. XML and JSON formats impose restrictions on the Strings that may be used in serialized data so it is necessary to define a transformation that ensures any Names can be used in the DataEncoding. The following rules are used to convert a DataType Name or a Structure Field Name to a string supported by the Encoding:

  1. Any character that is not permitted by the DataEncoding is replaced by an underscore (U+005F);
  2. A name with text sequence that is not valid in the first position has an underscore (U+005F) added as a prefix.

The character restrictions for the XML DataEncoding are:

<allowed-name>

= <letter> *(<allowed-char> / "_" / "-"/ ".")

<allowed-char>

= <letter> / DIGIT

<letter>

= UNICODE-LETTER

UNICODE-LETTER

Any Unicode character with a general category of ‘Letter’

In addition, XML names cannot start with the text ‘xml’ or any variation in case (i.e. ‘xMl’).

There are no restrictions for the JSON encoding other than the general restrictions defined in OPC 10000-3.

Table 8 has examples of XML encoded names.

Table 8 – Examples of XML Encoded Names

Hello

Hello

_Hello

_Hello

3DHello

_3DHello

冷水

冷水

3 (冷水。)-Hello

_3__冷水___-Hello