View Issue Details

IDProjectCategoryView StatusLast Update
000866810000-006: MappingsSpecpublic2023-09-20 11:36
ReporterFrank Fischer Assigned ToRandy Armstrong  
PrioritynormalSeveritymajorReproducibilityhave not tried
Status closedResolutionfixed 
Product Version1.05.01 
Fixed in Version1.05.03 
Summary0008668: Restrictions/Transformations for field and structure names in textual encodings
Description

The textual UA encodings like JSON and XML need the name for a structure and all its fields in order to encode it. For the name of the structure I cannot find a clear statement in the UA Specification, however it must be exposed in the address space, so it cannot be the symbolic name, but must be the text part of either the BrowseName or DisplayName e.g. for the 3DVector (i=18808) it must be "3DVector". For the fields it is the "Name" field of the StructureDefinition (again the symbolic name is not exposed so it cannot be used), for the 3DVector it would be X, Y, Z.

In JSON these names are used as JSON object names, so it would be beneficial for speed, size and compatibility if these do not contain characters which need escaping in JSON (quotation mark, (reverse) solidus and control characters). In XML these names are used as XML element names, so for example the encoding of the 3DVector inside an ExtensionObject would look like this:

<Body>
<3DVector>
<X>1</X>
<Y>2</Y>
<Z>3</Z>
</3DVector>
</Body>

Unfortunately XML element names have a few restrictions like not starting with a digit or the letters xml, so the 3DVector cannot be encoded using the UA XML encoding, which is confirmed by xmllint:

parser error : StartTag: invalid element name <3DVector>

So to be able to encode structures in textual encodings like JSON or XML, but also keeping possible other future encodings in mind it would useful to have the same restriciton as for symbolic names (only letters, digits and underscore allowed) for all UA texts that need to be used as element name in encodings. As it is a bit late for this restriction and it obviously already broken in NS0 an alternative would be to use a transformation (like replace everything non-digit, non-letter with underscore) for the names used in the encoding.

Depending on the solution this issue affects Part 3 and/or Part 6.

TagsNo tags attached.
Commit Version1.05.03
Fix Due Date

Activities

Randy Armstrong

2023-03-21 21:14

administrator   ~0018948

Solution: define a deterministic syntax to transform field names to valid symbols.

Randy Armstrong

2023-03-23 19:32

administrator   ~0019014

Added warning to Part 3 that Names are mangled by DataEncodings.

Added 5.1.13 Name Encoding Rules to Part 6.

Jim Luth

2023-03-23 19:40

administrator   ~0019015

Agreed to changes in Dallas meeting.

Matthias Damm

2023-09-15 12:34

developer   ~0019995

Last edited: 2023-09-15 12:44

The solution does not handle the issues mentioned, "xml" as starting letters would still be an allowed name

The solution requires for arbitrary unicode characters to know if these are in the 'Letter' category, this
requires a unicode lib, which is huge and impossible to implement for embedded devices. The default Unicode library on Linux has a size of 50MB.

The solution breaks existing applications that use common patterns e.g. if they use ‘my_name’ instead of ‘MyName’
my_name would be a valid XML element name.

Matthias Damm

2023-09-15 12:44

developer   ~0019996

Proposed changes to the solution:

The escaping should be limited to ASCI characters. This limits the escaping to two hex digits and does not require a Unicode library on an embedded runtime system.

Non letter Unicode characters should be completely forbidden and cannot be handled by OPC UA at all. They need to be rejected already by configuration applications.

We should allow more non letter ASCI characters that are valid in XML element names, especially ones that are commonly used in names like ‘_’ or ‘-‘ to make sure valid names are backward compatible.

We should use another escape character that is valid in XML but not common for names.

Randy Armstrong

2023-09-20 11:35

administrator   ~0020022

Changed the Name Encoding rules to only affect XML encoding.
Added restriction that field names cannot have control characters.

Jim Luth

2023-09-20 11:36

administrator   ~0020023

Agreed to changes in F2F.

Issue History

Date Modified Username Field Change
2023-01-31 14:33 Frank Fischer New Issue
2023-03-21 21:14 Randy Armstrong Note Added: 0018948
2023-03-21 21:30 Randy Armstrong Assigned To => Randy Armstrong
2023-03-21 21:30 Randy Armstrong Status new => assigned
2023-03-23 19:32 Randy Armstrong Status assigned => resolved
2023-03-23 19:32 Randy Armstrong Resolution open => fixed
2023-03-23 19:32 Randy Armstrong Fixed in Version => 1.05.03 RC1
2023-03-23 19:32 Randy Armstrong Note Added: 0019014
2023-03-23 19:40 Jim Luth Status resolved => closed
2023-03-23 19:40 Jim Luth Note Added: 0019015
2023-09-15 12:34 Matthias Damm Status closed => feedback
2023-09-15 12:34 Matthias Damm Resolution fixed => reopened
2023-09-15 12:34 Matthias Damm Note Added: 0019995
2023-09-15 12:35 Matthias Damm Note Edited: 0019995
2023-09-15 12:44 Matthias Damm Note Edited: 0019995
2023-09-15 12:44 Matthias Damm Note Added: 0019996
2023-09-20 11:35 Randy Armstrong Status feedback => resolved
2023-09-20 11:35 Randy Armstrong Resolution reopened => fixed
2023-09-20 11:35 Randy Armstrong Fixed in Version 1.05.03 RC1 => 1.05.03
2023-09-20 11:35 Randy Armstrong Note Added: 0020022
2023-09-20 11:36 Jim Luth Status resolved => closed
2023-09-20 11:36 Jim Luth Commit Version => 1.05.03
2023-09-20 11:36 Jim Luth Note Added: 0020023