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
NodeManagerUaNode.toNodeSet() doesn't validate against UANodeset.xsd schema
September 1, 2025
12:57, EEST
Avatar
riverplate
Member
Members
Forum Posts: 5
Member Since:
August 5, 2025
sp_UserOfflineSmall Offline

I am trying `NodeManagerUaNode.toNodeSet()`, and when I later want to validate the generated XML against `UANodeset.xsd` schema, I get the following error:
“If the ‘nillable’ attribute is false in the schema, the ‘xsi:nil’ attribute must not be present in the instance.” at this line:

uax:String xmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance” xsi:nil=”true”
Here’s some context for that XML line:
(well.. I couldn’t add it because apparently the greater than and smaller than characters get deleted, and I cannot find any markup reference for the forum)

September 1, 2025
13:44, EEST
Avatar
Matti Siponen
Moderator
Members

Moderators
Forum Posts: 362
Member Since:
February 11, 2020
sp_UserOfflineSmall Offline

Hello,

Can you send your NodeSet to jsdk-support@prosysopc.com so that we can investigate it?

September 3, 2025
19:06, EEST
Avatar
riverplate
Member
Members
Forum Posts: 5
Member Since:
August 5, 2025
sp_UserOfflineSmall Offline

I have sent the email with the related XML. The problem seems to occur when adding a Variable node with DataType String, with Attributes: ValueRank = OneDimension; ArrayDimensions = 1; Value = [null] (that’s the default value)

September 4, 2025
15:26, EEST
Avatar
Bjarne Boström
Moderator
Moderators
Forum Posts: 1067
Member Since:
April 3, 2012
sp_UserOfflineSmall Offline

The default value when a node is created with the SDK should be that there is no value (unless the VariableType had something) and thus that would not be written at all to the XML, though this is a relatively new feature. So basically for this to happen you must set a variant that has a string array and an element of this array must be null.

Technically Values are outside of the https://github.com/OPCFoundati…..odeSet.xsd, they are processContents=”lax” and can contain anything. The XML encoding of contents of Values is defined in the OPC UA Specification rules, not “by XML” (though it must be valid xml to be parsed). It is unlikely that namespaces defininmg custom Structure schemas would be available (SDK also doesn’t know them, it assumes they are the namespace+”Types.xsd when it writes the nodeset file”), thus in general I’m unsure how much sense it makes to try to validate the contents of Value tags by XML-means alone, it might not work as a general concept.

That being said, for the core types there is https://github.com/OPCFoundati……Types.xsd, which we do refer since that is what other NodeSets do. If we are pendantic, the ListOfString complex type defining the string-elements do not mark the elements itself as nillable, just the whole ListOfString element is. However, that does contradict what the spec text days https://reference.opcfoundatio…..docs/5.3.4 “The nillable attribute shall be specified because XML encoders will drop elements in arrays if those elements are empty.”. Now then, to me that “…XML encoders…” part looks a bit odd to me (at least we have no such limitation, though XML-writing basically doesn’t exist OPC UA -wise since the SOAP-version was deprecated ages ago), but regardless it does say the nillable attribute shall be specified. For most (UA-nullable) types that is the case in the schema, so it can be that it is a typo for the ListOfString. We might need to ask the OPC Foundation which way it goes.

The specification also has this general rule on empty-vs-null-vs-zero-length https://reference.opcfoundatio…..ocs/5.1.11, so in theory it could also mean that String in XML doesn’t have a null encoding. However ListOfByteString does have in the Opc.Ua.Types.xsd nillable elements and in general String and ByteString have much analogy.

Though, seems we would put nil for OPC UA types that do not have a null encoding, so there is at least that much bug that we need to fix in a future version.

September 4, 2025
15:46, EEST
Avatar
riverplate
Member
Members
Forum Posts: 5
Member Since:
August 5, 2025
sp_UserOfflineSmall Offline

Thanks for your reply. I see it is a bit of a gray area this topic.
Just to add to the thread, if I’d load the sent XML to UaModeler, then the error would be:

“`
Error in line 77 column 98:
Element {http://opcfoundation.org/UA/2008/02/Types.xsd}String is not
nillable.
“`

September 5, 2025
15:49, EEST
Avatar
Bjarne Boström
Moderator
Moderators
Forum Posts: 1067
Member Since:
April 3, 2012
sp_UserOfflineSmall Offline

Well.. probably it will be just easier at least short term that we try to make it match the schema, but this might take a while to implement.

September 18, 2025
17:35, EEST
Avatar
robertittto
New Member
Members
Forum Posts: 1
Member Since:
September 18, 2025
sp_UserOfflineSmall Offline

Bjarne Boström said
Well.. probably it will be just easier at least short term that we try to make it match the schema, but this might take a while to implement.  

I have also stumbled on this issue. Is it foreseen to release a fix?

September 19, 2025
10:14, EEST
Avatar
Bjarne Boström
Moderator
Moderators
Forum Posts: 1067
Member Since:
April 3, 2012
sp_UserOfflineSmall Offline

We have a beta build that should fix the issue, please send mail to jsdk-support@prosysopc.com (and refer this forum chain) if you wish to try.

It will be in the next release which I hope will happen during this month.

Forum Timezone: Europe/Helsinki
Most Users Ever Online: 1919
Currently Online:
Guest(s) 62
Top Posters:
Heikki Tahvanainen: 402
hbrackel: 144
rocket science: 100
pramanj: 86
Francesco Zambon: 83
Ibrahim: 78
Sabari: 62
kapsl: 57
gjevremovic: 49
Xavier: 43
Member Stats:
Guest Posters: 0
Members: 773
Moderators: 7
Admins: 1
Forum Stats:
Groups: 3
Forums: 15
Topics: 1558
Posts: 6567
Newest Members:
willardmackellar, vnedrenie_koPi, shaylaholton205, PhilesiaGen, rosaurathiel524, Arthurobext, stefanmacneil3, ralni, illuminationscanada, PhillipGit
Moderators: Jouni Aro: 1039, Pyry: 1, Petri: 1, Bjarne Boström: 1054, Jimmy Ni: 26, Matti Siponen: 359, Lusetti: 0
Administrators: admin: 1