MCPcopy Create free account
hub / github.com/FreeOpcUa/python-opcua / add_variable_common

Method add_variable_common

opcua/common/xmlexporter.py:237–251  ·  view source on GitHub ↗
(self, node, el)

Source from the content-addressed store, hash-verified

235 self._add_ref_els(obj_el, node)
236
237 def add_variable_common(self, node, el):
238 dtype = node.get_data_type()
239 if dtype.NamespaceIndex == 0 and dtype.Identifier in o_ids.ObjectIdNames:
240 dtype_name = o_ids.ObjectIdNames[dtype.Identifier]
241 self.aliases[dtype] = dtype_name
242 else:
243 dtype_name = self._node_to_string(dtype)
244 rank = node.get_value_rank()
245 if rank != -1:
246 el.attrib["ValueRank"] = str(int(rank))
247 dim = node.get_attribute(ua.AttributeIds.ArrayDimensions)
248 if dim.Value.Value:
249 el.attrib["ArrayDimensions"] = ",".join([str(i) for i in dim.Value.Value])
250 el.attrib["DataType"] = dtype_name
251 self.value_to_etree(el, dtype_name, dtype, node)
252
253 def add_etree_variable(self, node):
254 """

Callers 2

add_etree_variableMethod · 0.95

Calls 5

_node_to_stringMethod · 0.95
value_to_etreeMethod · 0.95
get_data_typeMethod · 0.80
get_value_rankMethod · 0.80
get_attributeMethod · 0.80

Tested by

no test coverage detected