Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
O
opcua-asyncio
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Nikola Balog
opcua-asyncio
Commits
6db39b1a
Commit
6db39b1a
authored
Jul 17, 2019
by
oroulet
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Harold Howe: XML exporter handle nodes with a null description
parent
0425f17f
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
7 deletions
+16
-7
asyncua/common/xmlexporter.py
asyncua/common/xmlexporter.py
+4
-2
tests/test_xml.py
tests/test_xml.py
+12
-5
No files found.
asyncua/common/xmlexporter.py
View file @
6db39b1a
...
...
@@ -185,7 +185,9 @@ class XmlExporter:
nodeid
=
node
.
nodeid
parent
=
await
node
.
get_parent
()
displayname
=
(
await
node
.
get_display_name
()).
Text
desc
=
(
await
node
.
get_description
()).
Text
desc
=
await
node
.
get_description
()
if
desc
:
desc
=
desc
.
Text
node_el
=
Et
.
SubElement
(
self
.
etree
.
getroot
(),
nodetype
)
node_el
.
attrib
[
"NodeId"
]
=
self
.
_node_to_string
(
nodeid
)
node_el
.
attrib
[
"BrowseName"
]
=
self
.
_bname_to_string
(
browsename
)
...
...
@@ -413,7 +415,7 @@ class XmlExporter:
def
_get_member_order
(
self
,
dtype
,
val
):
"""
If an dtype has an entry in XmlExporter.extobj_ordered_elements return the export order of the elements
If an dtype has an entry in XmlExporter.extobj_ordered_elements return the export order of the elements
else return the unordered members.
"""
if
dtype
not
in
XmlExporter
.
extobj_ordered_elements
.
keys
():
...
...
tests/test_xml.py
View file @
6db39b1a
...
...
@@ -191,6 +191,13 @@ async def test_xml_string(opc, tmpdir):
await
_test_xml_var_type
(
opc
,
tmpdir
,
o
,
"string"
)
async
def
test_xml_string_with_null_description
(
opc
,
tmpdir
):
o
=
await
opc
.
opc
.
nodes
.
objects
.
add_variable
(
2
,
"xmlstring"
,
"mystring"
)
await
o
.
set_attribute
(
ua
.
AttributeIds
.
Description
,
ua
.
DataValue
(
None
))
o2
=
await
_test_xml_var_type
(
opc
,
tmpdir
,
o
,
"string"
)
assert
await
o
.
get_description
()
==
await
o2
.
get_description
()
async
def
test_xml_string_array
(
opc
,
tmpdir
):
o
=
await
opc
.
opc
.
nodes
.
objects
.
add_variable
(
2
,
"xmlstringarray"
,
[
"mystring2"
,
"mystring3"
])
node2
=
await
_test_xml_var_type
(
opc
,
tmpdir
,
o
,
"stringarray"
)
...
...
@@ -324,7 +331,7 @@ async def test_xml_custom_uint32(opc, tmpdir):
async
def
test_xml_var_nillable
(
opc
):
xml
=
"""
<UANodeSet xmlns="http://opcfoundation.org/UA/2011/03/UANodeSet.xsd" xmlns:uax="http://opcfoundation.org/UA/2008/02/Types.xsd" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<NamespaceUris>
<NamespaceUris>
</NamespaceUris>
<Aliases>
<Alias Alias="Boolean">i=1</Alias>
...
...
@@ -341,9 +348,9 @@ async def test_xml_var_nillable(opc):
</References>
<Value>
<uax:String></uax:String>
</Value>
</Value>
</UAVariable>
<UAVariable BrowseName="2:xmlbool" DataType="Boolean" NodeId="ns=2;s=test_xml.bool.nillabel" ParentNodeId="i=85">
<DisplayName>xmlbool</DisplayName>
<Description>xmlbool</Description>
...
...
@@ -354,8 +361,8 @@ async def test_xml_var_nillable(opc):
<Value>
<uax:Boolean></uax:Boolean>
</Value>
</UAVariable>
</UAVariable>
</UANodeSet>
"""
_new_nodes
=
await
opc
.
opc
.
import_xml
(
xmlstring
=
xml
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment