You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The namespace index of exported nodes will not match up with what is observed in UaExpert. This is because the nodeset only contains the namespaces of nodes in the NodeSet.
To Reproduce
Connect to a server and export the XML using a subset of all nodes, e.g
And the namespace index of nodes will all be 1, and not 3 like they should be. (I think they are not 0, because the NamespaceUris implicitly contains http://opcfoundation.org/UA/ as index 0, even if it looks like the 0 index is http://www.helloworld.com/OPCUA/MyNamespace.
I think the issue is related to this function
asyncdef_add_namespaces(self, nodes):
ns_array=awaitself.server.get_namespace_array()
idxs=awaitself._get_ns_idxs_of_nodes(nodes)
# now create a dict of idx_in_address_space to idx_in_exported_fileself._addr_idx_to_xml_idx=self._make_idx_dict(idxs, ns_array)
ns_to_export= [ns_array[i] foriinsorted(list(self._addr_idx_to_xml_idx.keys())) ifi!=0]
# write namespaces to xmlself._add_namespace_uri_els(ns_to_export)
Version
Python-Version: 3
opcua-asyncio Version: 1.1.5
The text was updated successfully, but these errors were encountered:
This calls add_namespace_uri_els with all namespaces before calling build_etree. To get around the issue of the use of the _addr_idx_to_xml_idx map while building the etree for each node, it overrides the _make_idx_dict function so the address space idxs are the same as the etree idxs.
asyncdefexport_xml_with_all_namespaces(client: Client, nodes: List[Node], output_file_path: str, export_values: bool):
print("Warning! Exporting all namespaces is an experimental feature and may not work as expected.")
exp=XmlExporter(client, export_values=export_values)
ns_array=awaitexp.server.get_namespace_array()
exp._add_namespace_uri_els(ns_array)
def_make_idx_dict(idxs: List[int], ns_array: List[str])->Dict[int, int]:
return {idx: idxforidxinidxs}
exp._make_idx_dict=_make_idx_dictawaitexp.build_etree(nodes)
awaitexp.write_xml(output_file_path)
Describe the bug
The namespace index of exported nodes will not match up with what is observed in UaExpert. This is because the nodeset only contains the namespaces of nodes in the NodeSet.
To Reproduce
Connect to a server and export the XML using a subset of all nodes, e.g
There will only be one element in the
NamespaceUris
array, e.g.And the namespace index of nodes will all be
1
, and not3
like they should be. (I think they are not0
, because theNamespaceUris
implicitly containshttp://opcfoundation.org/UA/
as index0
, even if it looks like the0
index ishttp://www.helloworld.com/OPCUA/MyNamespace
.I think the issue is related to this function
Version
Python-Version: 3
opcua-asyncio Version: 1.1.5
The text was updated successfully, but these errors were encountered: