DataType node: implementation of DataTypeDefinition attribute
Description
The DataType node class has an optional attribute called DataTypeDefinition. Since OPC UA specification v1.05 this attribute shall be used to define the DataType encoding description (DataTypeDictionary way has been deprectated, see part 5 §B.1). Moreover this attribute is indicated as mandatory in most of DataType instance cases (see part 3 Table 16): structure, enumerated types, etc.
Analysis
In order to define this attribute is is first necessary to parse the XML Definition tag of DataType nodes, this is not sufficient since the DataTypeDefinition structure.
Note: in a Definition tag, the expected definition type is not explicit: StructureDefinition (+StructureType) or EnumDefinition. It is only possible to determine it from the attributes present in Field tags and the (indirect) parent of well known DataType (Structure, Enum, UInteger representing an OptionSet <=> EnumDefinition, etc.).
Implementation
It is decided to implement the following:
- Parsing and definition of DataTypeDefinition in XML NodeSet loaders:
- Union and Structure with optional fields are excluded since those are not supported by encoders (Definition skipped)
- Definition child tags Description / DisplayName are ignored
- EnumDefinition-like starting with Field using a default Value (-1) are not supported (parsing failure)
- StructureDefinition Fields following attributes are ignored: SymbolicName
- In case the necessary references are not present from a Structure-like DataType node to retrieve the direct parent id and encoding nodes id, the corresponding NodeId will remain Null in the StructureDefinition.
- Read of DataTypeDefinition attribute (possible only when parsing succeeded)