In Table 12, the direct mapping of XML data types and OPC UA DataTypes is defined. If there are any restrictions on a lossless, bidirectional mapping, this is described in the Comment column. If this column is empty, there are no restrictions.
Table 12 – Mapping of DataTypes
OPC UA DataType |
XML DataType |
Comment |
String |
string |
Implementations might limit the maximum String size. |
Boolean |
boolean |
|
Decimal |
decimal |
Implementations might limit the maximum Decimal size. |
Float |
float |
|
Double |
double |
|
Duration |
duration |
In this mapping there might be a loss in precision (XML only requires down to minimum fractional second precision of milliseconds, OPC UA based Duration is a double (representing milliseconds). |
DateTime |
dateTime |
Many implementations will not be able to represent the full range of DateTime values. To maximize interoperability, the following rules apply:
When going from XML to an implementation:
When going from an implementation to XML:
Where:
The value of MinDate is the default value and semantically equivalent to a Null value. |
UtcTime |
dateTimeTimestamp |
See limitations of DateTime |
ByteString |
base64Binary |
XML has two ByteString representations – hexBinary and base64Binary. The mapping of OPC UA ByteString to XML base64Binary is defined in OPC 10000-6. The mapping to XML hexBinary is defined in section 5.4. Implementations might limit the maximum ByteString size. |
Int64 |
long |
|
Int32 |
int |
|
Int16 |
short |
|
SByte |
byte |
|
UInt64 |
unsignedLong |
|
UInt32 |
unsignedInt |
|
UInt16 |
unsignedShort |
|
Byte |
unsignedByte |
|
NormalizedString |
normalizedString |
Implementations might limit the maximum String size. In OPC UA, limitations on the string are only defined in the specification but not explicitly defined by the data structure, so implementations not following the specification may provide invalid values. |
LocaleId |
language |
Both data types are based on strings defined in IETF RFC 5646 and should represent the same format, e.g., “en-US”. OPC UA allows an empty or null string, which is not allowed in XML. In OPC UA, limitations on the string are only defined in the specification but not explicitly defined by the data structure, so implementations not following the specification may provide invalid values. In XML, the schema definition only restricts the allowed values to a certain degree, so implementations not following the specification may provide invalid values. XML only restricts the allowed values to a certain degree in its schema definition, so potentially values could be invalid. |
UriString |
anyURI |
Implementations might limit the maximum String size. |