An ExpandedNodeId extends the NodeId structure.

An ExpandedNodeId extends the NodeId structure by allowing the NamespaceUri to be explicitly specified instead of using the NamespaceIndex. The NamespaceUri is optional. If it is specified then the NamespaceIndex inside the NodeId shall be ignored.

The ExpandedNodeId is encoded by first encoding a NodeId as described in Clause 5 .2.2.9 and then encoding NamespaceUri as a String.

An instance of an ExpandedNodeId may still use the NamespaceIndex instead of the NamespaceUri. In this case, the NamespaceUri is not encoded in the stream. The presence of the NamespaceUri in the stream is indicated by setting the NamespaceUri flag in the encoding format byte for the NodeId.

If the NamespaceUri is present then the encoder shall encode the NamespaceIndex as 0 in the stream when the NodeId portion is encoded. The unused NamespaceIndex is included in the stream for consistency,

An ExpandedNodeId may also have a ServerIndex which is encoded as a UInt32 after the NamespaceUri. The ServerIndex flag in the NodeId encoding byte indicates whether the ServerIndex is present in the stream. The ServerIndex is omitted if it is equal to zero.

Hierarchy (view full)

Constructors

  • Parameters

    • forDeserialization: null

    Returns ExpandedNodeId

  • Parameters

    • identifierType: NodeIdType

      the nodeID type

    • value: string | number | Buffer

      the node id value. The type of Value depends on identifierType.

    • namespace: number

      the index of the related namespace (optional , default value = 0 )

    • OptionalnamespaceUri: null | string

      NamespaceUri

    • OptionalserverIndex: number

      the server Index

    Returns ExpandedNodeId

Properties

identifierType: NodeIdType
namespace: number
namespaceUri: null | string
serverIndex: number
value: string | number | Buffer
NodeIdType: typeof NodeIdType
nullExpandedNodeId: ExpandedNodeId
nullNodeId: NodeId
resolveNodeId: ((a: string | NodeId) => NodeId)
sameNodeId: ((n1: NodeId, n2: NodeId) => boolean)

Methods

  • Returns string

  • returns true if the NodeId is null or empty

    Returns boolean

  • convert nodeId to a JSON string. same as toString

    Returns any

  • get the string representation of the nodeID.

    Returns string

    by default, toString will return the "ns=" representation

    const nodeid = new NodeId(NodeIdType.NUMERIC, 123,1);
    console.log(nodeid.toString());
    >"ns=1;i=123"
    

    toString can also be used to make the nsu= version of the nodeid.

    const namespaceArray = ["http://opcfoundation.com/UA/","http://mynamespace2"];
    const nodeid = new NodeId(NodeIdType.STRING, "Hello",1);
    console.log(nodeid.toString({namespaceArray}));
    >"nsu=http://mynamespace;i=123"
    

    passing an addressSpace to the toString options will decorate the nodeId with the BrowseName of the node.

    const addressSpace = getAddressSpace();
    const nodeid = new NodeId(NodeIdType.NUMERIC, 123,1);
    console.log(nodeid.toString({addressSpace}));
    >"nsu=http://mynamespace;i=123 (MyBrowseName)"
    
  • Parameters

    • nodeId: NodeId
    • OptionalnamespaceUri: string
    • OptionalserverIndex: number

    Returns ExpandedNodeId