Question about XML-encoded QualifiedName|OPC UA Standard|Forum|OPC Foundation

Avatar
Search
Forum Scope


Match



Forum Options



Minimum search word length is 3 characters - maximum search word length is 84 characters
Lost password?
sp_Feed sp_PrintTopic sp_TopicIcon
Question about XML-encoded QualifiedName
Avatar
Vincent Lacroix
Member
Members
Forum Posts: 14
Member Since:
07/06/2017
sp_UserOfflineSmall Offline
1
10/16/2017 - 13:50
sp_Permalink sp_Print

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,

Avatar
Zbynek Zahradnik
Member
Members
Forum Posts: 62
Member Since:
02/24/2014
sp_UserOfflineSmall Offline
2
10/17/2017 - 00:56
sp_Permalink sp_Print

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.

Avatar
Randy Armstrong
Admin
Forum Posts: 1579
Member Since:
05/30/2017
sp_UserOfflineSmall Offline
3
10/17/2017 - 07:28
sp_Permalink sp_Print

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.  

Avatar
Vincent Lacroix
Member
Members
Forum Posts: 14
Member Since:
07/06/2017
sp_UserOfflineSmall Offline
4
11/07/2017 - 02:34
sp_Permalink sp_Print

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,

Avatar
Randy Armstrong
Admin
Forum Posts: 1579
Member Since:
05/30/2017
sp_UserOfflineSmall Offline
5
11/10/2017 - 08:26
sp_Permalink sp_Print

Part 3 defines the BrowseName type.

The OPC-F controls all NS0 names and the WGs, by convention, will not define a BrowseName starting with a number and ‘:’. 

Other groups working with non-NS0 models have no such restriction.

Avatar
Jürgen Veidt
Member
Members
Forum Posts: 7
Member Since:
05/24/2016
sp_UserOfflineSmall Offline
6
09/11/2019 - 06:05
sp_Permalink sp_Print sp_EditHistory

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?

Avatar
Randy Armstrong
Admin
Forum Posts: 1579
Member Since:
05/30/2017
sp_UserOfflineSmall Offline
7
09/12/2019 - 01:23
sp_Permalink sp_Print sp_EditHistory

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.

Avatar
Jürgen Veidt
Member
Members
Forum Posts: 7
Member Since:
05/24/2016
sp_UserOfflineSmall Offline
8
09/12/2019 - 02:51
sp_Permalink sp_Print

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?

Avatar
Randy Armstrong
Admin
Forum Posts: 1579
Member Since:
05/30/2017
sp_UserOfflineSmall Offline
9
09/12/2019 - 06:36
sp_Permalink sp_Print

Yes, 0:Name or Name are the same.

There is no expectation that modellers avoid underscores and no escaping is required.

Avatar
Djamelo Fotso
New Member
Members
Forum Posts: 1
Member Since:
09/13/2019
sp_UserOfflineSmall Offline
10
09/13/2019 - 09:47
sp_Permalink sp_Print sp_EditHistory

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?

Avatar
Randy Armstrong
Admin
Forum Posts: 1579
Member Since:
05/30/2017
sp_UserOfflineSmall Offline
11
09/13/2019 - 19:45
sp_Permalink sp_Print

Yes. Always strip off any leading 0:

Forum Timezone: America/Phoenix
Most Users Ever Online: 510
Currently Online:
Guest(s) 51
Currently Browsing this Page:
1 Guest(s)
Top Posters:
Forum Stats:
Groups: 2
Forums: 10
Topics: 1445
Posts: 4889