An example of the UANodeSetcan be found below.

This example defines the Nodesfor an InformationModelwith the URI of “http://sample.com/Instances”. This example references Nodesdefined in the base OPC UA InformationModeland an InformationModelwith the URI “http://sample.com/Types”.

The XML namespaces declared at the top include the URIs for the Namespacesreferenced in the document because the document includes Complex Data. Documents without Complex Datawould not have these declarations.

<UANodeSet

xmlns:s1="http://sample.com/Instances"

xmlns:s0="http://sample.com/Types"

xmlns:uax="http://opcfoundation.org/UA/2008/02/Types.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://opcfoundation.org/UA/2011/03/UANodeSet.xsd">

The NamespaceUristable includes all Namespacesreferenced in the document except for the base OPC UA InformationModel. A NamespaceIndexof 1 refers to the URI “http://sample.com/Instances”.

<NamespaceUris>

<Uri>http://sample.com/Instances</Uri>

<Uri>http://sample.com/Types</Uri>

</NamespaceUris>

The Aliasestable is provided to enhance readability. There are no rules for what is included. A useful guideline would include standard ReferenceTypesand DataTypesif they are referenced in the document. An Aliasmay be used for any NodeIdvalue in the document except for NodeIdsthat appear in Valuesof Variablesor VariableTypes.

<Aliases>

<Alias Alias="HasComponent">i=47</Alias>

<Alias Alias="HasProperty">i=46</Alias>

<Alias Alias="HasSubtype">i=45</Alias>

<Alias Alias="HasTypeDefinition">i=40</Alias>

</Aliases>

The BicycleTypeis a DataType Nodethat inherits from a DataTypedefined in another InformationModel(ns=2;i=314). It is assumed that any application importing this file will already know about the referenced InformationModel. A Servercould map the references onto another OPC UA Serverby adding a ServerIndexto TargetNode NodeIds. The structure of the DataTypeis defined by the Definitionelement. This information can be used by code generators to automatically create serializers for the DataType.

<UADataType NodeId="ns=1;i=365" BrowseName="1:BicycleType">

<DisplayName>BicycleType</DisplayName>

<References>

<Reference ReferenceType="HasSubtype" IsForward="false">ns=2;i=314</Reference>

</References>

<Definition Name="BicycleType">

<Field Name="NoOfGears" DataType="UInt32" />

<Field Name="ManufacturerName" DataType="String" />

</Definition>

</UADataType>

This Nodeis an instance of an Object TypeDefinition Nodedefined in another InformationModel(ns=2;i=341). It has a single Propertywhich is declared later in the document.

<UAObject NodeId="ns=1;i=375" BrowseName="1:DriverOfTheMonth" ParentNodeId="ns=1;i=281">

<DisplayName>DriverOfTheMonth</DisplayName>

<References>

<Reference ReferenceType="HasProperty">ns=1;i=376</Reference>

<Reference ReferenceType="HasTypeDefinition">ns=2;i=341</Reference>

<Reference ReferenceType="HasComponent" IsForward="false">ns=1;i=281</Reference>

</References>

</UAObject>

This Nodeis an instance of a Variable TypeDefinition Nodedefined in base OPC UA InformationModel(i=68). The DataTypeis the base type for the BicycleType DataType.The AccessLevelsdeclare the Variableas Readableand Writeable. The ParentNodeId indicates that this Node is tightly coupled with the Parent (DriverOfTheMonth) and will be deleted if the Parent is deleted.

<UAVariable NodeId="ns=1;i=376" BrowseName="2:PrimaryVehicle"

ParentNodeId="ns=1;i=375" DataType="ns=2;i=314" AccessLevel="3">

<DisplayName>PrimaryVehicle</DisplayName>

<References>

<Reference ReferenceType="HasTypeDefinition">i=68</Reference>

<Reference ReferenceType="HasProperty" IsForward="false">ns=1;i=375</Reference>

</References>

This Valueis an instance of a BicycleType DataType. It is wrapped in an ExtensionObjectwhich declares that the value is serialized using the Default XML DataTypeEncodingfor the DataType. The Valuecould be serialized using the Default Binary DataTypeEncodingbut that would result in a document that cannot be edited by hand. No matter which DataTypeEncodingis used, the NamespaceIndexused in the ManufactureNamefield refers to the NamespaceUristable in this document. The application is responsible for changing whatever value it needs to be when the document is loaded by an application.

<Value>

<ExtensionObject xmlns="http://opcfoundation.org/UA/2008/02/Types.xsd">

<TypeId>

<Identifier>ns=1;i=366</Identifier>

</TypeId>

<Body>

<s1:BicycleType>

<s0:Make>Trek</s0:Make>

<s0:Model>Compact</s0:Model>

<s1:NoOfGears>10</s1:NoOfGears>

<s1:ManufactureName>

<uax:NamespaceIndex>1</uax:NamespaceIndex>

<uax:Name>Hello</uax:Name>

</s1:ManufactureName>

</s1:BicycleType>

</Body>

</ExtensionObject>

</Value>

</UAVariable>

These are the DataTypeEncoding Nodesfor the BicycleType DataType.

<UAObject NodeId="ns=1;i=366" BrowseName="Default XML">

<DisplayName>Default XML</DisplayName>

<References>

<Reference ReferenceType="HasEncoding" IsForward="false">ns=1;i=365</Reference>

<Reference ReferenceType="HasTypeDefinition">i=76</Reference>

</References>

</UAObject>

<UAObject NodeId="ns=1;i=370" BrowseName="Default Binary">

<DisplayName>Default Binary</DisplayName>

<References>

<Reference ReferenceType="HasEncoding" IsForward="false">ns=1;i=365</Reference>

<Reference ReferenceType="HasTypeDefinition">i=76</Reference>

</References>

</UAObject>