Avatar
Please consider registering
guest
sp_LogInOut Log Insp_Registration Register
Register | Lost password?
Advanced Search
Forum Scope


Match



Forum Options



Minimum search word length is 3 characters - maximum search word length is 84 characters
sp_Feed Topic RSSsp_TopicIcon
Create new UaNodeset using UaNodeSet class
May 4, 2026
14:40, EEST
Avatar
hbrackel
Member
Members
Forum Posts: 148
Member Since:
February 21, 2014
sp_UserOfflineSmall Offline

Edited from the original post

I’d like to generate a nodesest.xml file from an in-memory addressSpace (ideally, without even running a server ). Does the SDK provide a utility for this purpose or am I required to serialize the nodes / nodeset manually to XML?

Many thanks for your support

May 4, 2026
17:21, EEST
Avatar
Bjarne Boström
Moderator
Moderators
Forum Posts: 1105
Member Since:
April 3, 2012
sp_UserOfflineSmall Offline

Hi,

Seems you edited the question while I was writing a complicated answer. Thus an edited shorter version of that below.

You will need to represent data as ‘UaNodes’. Due to history of the SDK, it is kinda hard to do “data only” representation of the server (or alternative UaNode implementations). You might try just UaServer.init without starting, or just bind to 127.0.0.1 only and use normal UaNodes. Then you can use NodeManagerUaNode.toNodeSet() + UaNodeSet.toXml(). It is not recommended to write the core namespace (index 0). Also the index 1 should typically be ignored, as often it contains diagnotics nodes only. In case you read stuff back to our SDK server, it should be noted that UaServer.init does create the namespaces in index 0 and 1 by itself, that should not be modified.

There is not a public way yet to export more than one namespace per UaNodeSet. However, we do have these “public internal” ones:
https://documentation.prosysop…..arser.html
https://documentation.prosysop…..arser.html

They have a bit more stuff that was not public-ready, but needed for Browser(nodeset export in pro) and SimulationServer. The classes are public, though they should be considered as internal, i.e. we could remove/modify these at will (though most likely we will need something similar anyway in some form ourselves). I can try to explain in more detail later if needed, but short versions: The InternalUaNodeSetNodeManagerUaNodeParser mostly is NodeManagerUaNode.toNodeSet() with few additional options. InternalUaNodeSetAddressSpaceParser (NodeManagerTable does implement UaAddressSpace) can write any Set of UaNodes (of that UaAddressSpace), not limited to ones of the same namespace. Though note that the constructor parameter “primaryNamespace” will become the index 1 for model purposes (since typically a model has just one “provided namespace” and it typically is index 1, rest of NamespaceUri list is typically dependencies). The rest will depend on iteration orders. Also, I heavily recommend exporting complete namespaces (one or more), or you might end up with an invalid model.

P.S.
I can explain later, if needed, but there is sort of an issue regarding cyclic dependencies, which might occur for weirder models. The internal ones have a parameter to break these if it can be done from the outside, but we have not found a proper “UA way” for this. SDK does apply some heuristics in order to determine which namespaces are dependencies and which are not regarding references.

May 5, 2026
16:31, EEST
Avatar
hbrackel
Member
Members
Forum Posts: 148
Member Since:
February 21, 2014
sp_UserOfflineSmall Offline

Thank you very much for the swift reply.

I think that either of the 3 options will work for producing a nodeset. The only open subject would be the addition of NodeSet Extensions elements. We would want to add non-OPC UA configuration information like PLC data tag mappings etc into the nodeset as well as a single-source-of-truth.

May 6, 2026
10:21, EEST
Avatar
Bjarne Boström
Moderator
Moderators
Forum Posts: 1105
Member Since:
April 3, 2012
sp_UserOfflineSmall Offline

We have added at some point limited support for the Extensions. Since they are not in the UA’s node-model they are only in the server-side implementation UaNodes:
ServerNode.setNodeSetExtensions(UaNodeSetExtensions)
ServerNode.getNodeSetExtensions()

All server-side UaNodes are (and must be) ServerNode-based, so they can be casted to it (or if creating instances, the XXXTypeNode.class can be used instead of XXXType.class, if known and using class-based createInstance methods).

For now the UaNodeSetExtensions is still quite … crude. It is just a wrapper for the raw whole Extensions XML element, including the Extensions element definition. It be created with UaNodeSetExtensions.parse(String) (doesn’t validate anything yet) and the UaNodeSetExtensions.getRawXml() gives the raw xml back. Note that it might not be 1:1 for exporting/loadingh the model e.g. some whitespaces might change and the xml namespaces might need some experimenting, we have not explored this that much. The following should work, let us know if there are issues:

String extensionsXml =
"<Extensions xmlns=\"http://opcfoundation.org/UA/20…..odeSet.xsd\">"
+ " <Extension>"
+ " <prosys:ProsysExtension xmlns:prosys=\"http://www.prosysopc.com/OPCUA…..nsions.xsd\">"
+ " <prosys:Name>ExtensionName1</prosys:Name>"
+ " </prosys:ProsysExtension>"
+ " </Extension>"
+ " <Extension>"
+ " <prosys:ProsysExtension xmlns:prosys=\"http://www.prosysopc.com/OPCUA…..nsions.xsd\">"
+ " <prosys:Name>ExtensionName2</prosys:Name>"
+ " </prosys:ProsysExtension>"
+ " </Extension>"
+ "</Extensions>";
node.setNodeSetExtensions(UaNodeSetExtensions.parse(extensionsXml));

(… some day we will have better code-block for the forum, anyway think there is a newline character at the end of each line’s String data)

The xmlns needs to be defined for the Extensions element. And since it and Extension element are in the UANodeSet.xsd, I think using any own namespaces must be defined within each element that is inside the Extension like above. The resulted total XML for the model isn’t as pretty as I would like it to be, as the xmlns:prosys part wont get “elevated” yet to the whole document root element XML namespaces definition.

Forum Timezone: Europe/Helsinki
Most Users Ever Online: 1919
Currently Online:
Guest(s) 46
Currently Browsing this Page:
1 Guest(s)
Top Posters:
Heikki Tahvanainen: 402
hbrackel: 146
rocket science: 114
pramanj: 86
Francesco Zambon: 83
Ibrahim: 78
Sabari: 62
kapsl: 57
gjevremovic: 49
Xavier: 43
Member Stats:
Guest Posters: 0
Members: 904
Moderators: 7
Admins: 1
Forum Stats:
Groups: 3
Forums: 15
Topics: 1587
Posts: 6693
Newest Members:
Taylorlly, heathdallachy85, dewittfrantz2, devonkeenan47, Michaelkam, chnmrc, ahmad.qureshi3@se.abb.com, connieorchard88, carlotae86, otiliabanks
Moderators: Jouni Aro: 1058, Pyry: 1, Petri: 1, Bjarne Boström: 1081, Jimmy Ni: 26, Matti Siponen: 370, Lusetti: 1
Administrators: admin: 1