07/06/2017
Hi,
We have a question about the encoding of fields that are of type QualifiedName, for instance the BrowseName of a node. We understand that there are several encodings :
When the BrowseName is XML encoded, it has the following structure, as per specification 1.03 Part 4 §5.3.1.14 :
<xs:complexType name=”QualifiedName”>
<xs:sequence>
<xs:element name=”NamespaceIndex” type=”xs:int” minOccurs=”0″ />
<xs:element name=”Name” type=”xs:string” minOccurs=”0″ />
</xs:sequence> </xs:complexType>
which is coherent with what is found in Opc.Ua.Types.bsd.xml
<opc:StructuredType Name=”QualifiedName”>
<opc:Documentation>A string qualified with a namespace index.</opc:Documentation>
<opc:Field Name=”NamespaceIndex” TypeName=”opc:Int32″ />
<opc:Field Name=”Name” TypeName=”opc:CharArray” />
</opc:StructuredType>
When the BrowseName is described in the node sets xml (e.g. Opc.Ua.NodeSet2.xml), the BrowseName is a simple string, as described by the UANodeSet.xsd : <xs:simpleType name=”QualifiedName”> <xs:restriction base=”xs:string”></xs:restriction> </xs:simpleType> which is understandable, as the BrowseName is an attribute. However, in specification 1.03 Part 6 Annex F.3, it is said that “[the BrowseName is] a QualifiedName serialized as a String with the form: <namespace index>:<name> Where the NamespaceIndex refers to the NamespaceUris table.”. This form tends to make the colon mandatory. The colon is not present in Opc.Ua.NodeSet2.xml.
The questions are:
Did we correctly identified how a QualifiedName is encoded?
Why are there two encoded forms for QualifiedNames?
Is there some specification that defines QualifiedNames with optional colon?
Thanks, Best regards,
02/24/2014
I am sure others will have more qualified replies here to help you out, but AFAIK, you have it right. The “encoding” is really just the first form; the other (nodeset) does not appear in OPC UA “runtime” anywhere. And the reasons might be historical or simply an overlook.
Thinking about it, however, some more observations came to my mind:
– I am not aware of any limitation to the name part of the QualifiedName other than it should not exceed 512 characters. If so, even the name itself can start with a number and a colon. That would bring ambiguity in the syntax used in the nodeset, if the index and colon are treated as optional. Because “1:MyName” could then either denote a NamespaceIndex=1 and Name=”MyName”, or NamespaceIndex=0 and Name=”1:MyName”.
– I do not see the spec saying that the name part shall not be empty, which would be a reasonable restriction.
05/30/2017
The UANodeSet is a specialized import/export format which is not used in any over the wire communication between applications.
The UA XML encoding are rules used by UA apps to communicate using XML messages.
The BrowseName text is “Unicode character string that should exclude control characters that are not whitespaces.”.
The UANodeSet format presumes that the OPC-F (i.e. namespace 0) would never define a BrowseName starting with a number and a colon. Other information models can do this because the index prefix must always be there so 1:1:X would be the BrowseName “1:X” in Namespace 1.
A blank BrowseName in NS0 is defined to be a NULL BrowseName.
Other namespaces could blank BrowseNames them but it does not make sense.
07/06/2017
Hi,
Thanks for your responses.
Could you point us toward the spec section that contains “Unicode character string that should exclude control characters that are not whitespaces.” ?
Are the “control characters” defined somewhere ?
When you say:
The UANodeSet format presumes that the OPC-F (i.e. namespace 0) would never define a BrowseName starting with a number and a colon.
Is this taken from the spec ?
Many thanks,
Best regards,
05/24/2016
Does this mean BrowseName=”https://opcfoundation.org/UA/” is valid? I have seen this in a nodeset file.
Specification part 5 states for the NamespaceMetadataType:
“The BrowseName of instances of this type shall be derived from the represented namespace. This can, for example, be done by using the index of the namespace in the NamespaceArray as namespaceIndex of the QualifiedName and the namespace URI as name of the QualifiedName.”
Why are the words “derived” and “for example” used here? The issue with certain characters isn’t mentioned.
Additional question: “_” is defined as the separator between browse names in browse pathes, so it doesn’t seem to be a good idea to have it in a browse name?
05/30/2017
That Node is an instance. I was referring to the Types defined in the specification.
If you want to write a parser you should check for a sequence digits followed by a :
If a non-digit is encountered before the : then assume namespace 0
Otherwise, strip off the namespace index when the : is found.
The use of _ is only a convention used by the ModelCompiler and modellers using the ModelCompiler are restricted by it.
It is not a limitation imposed by the specification.
05/24/2016
Thanks for the confimation. This means the xmlimporter I use doesn’t handle this special case correctly.
There is no rule to always omit ns 0, right? So “0:Name” means “Name” in ns 0, not “0:Name” in ns 0?
Regarding the underscore, is it expected that the modellers restrict the BrowseNames to not use underscores, or would they implement some escaping/quoting schema?
09/13/2019
Thanks for the confimation. This means the xmlimporter I use doesn’t handle this special case correctly.
There is no rule to always omit ns 0, right? So “0:Name” means “Name” in ns 0, not “0:Name” in ns 0?
Regarding the underscore, is it expected that the modellers restrict the BrowseNames to not use underscores, or would they implement some escaping/quoting schema?
1 Guest(s)