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
2e20a1bc
Commit
2e20a1bc
authored
Oct 12, 2016
by
olivier R-D
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
xmlexport: also migrate idx of parent and reference targets
parent
d5c5398f
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
4 deletions
+8
-4
opcua/common/xmlexporter.py
opcua/common/xmlexporter.py
+2
-2
tests/tests_xml.py
tests/tests_xml.py
+6
-2
No files found.
opcua/common/xmlexporter.py
View file @
2e20a1bc
...
...
@@ -172,7 +172,7 @@ class XmlExporter(object):
if
parent
is
not
None
:
node_class
=
node
.
get_node_class
()
if
node_class
in
(
ua
.
NodeClass
.
Object
,
ua
.
NodeClass
.
Variable
,
ua
.
NodeClass
.
Method
):
node_el
.
attrib
[
"ParentNodeId"
]
=
parent
.
nodeid
.
to_string
(
)
node_el
.
attrib
[
"ParentNodeId"
]
=
self
.
_node_to_string
(
parent
)
self
.
_add_sub_el
(
node_el
,
'DisplayName'
,
displayname
)
if
desc
not
in
(
None
,
""
):
self
.
_add_sub_el
(
node_el
,
'Description'
,
desc
.
decode
(
'utf-8'
))
...
...
@@ -308,7 +308,7 @@ class XmlExporter(object):
ref_el
.
attrib
[
'ReferenceType'
]
=
ref_name
if
not
ref
.
IsForward
:
ref_el
.
attrib
[
'IsForward'
]
=
'false'
ref_el
.
text
=
ref
.
NodeId
.
to_string
(
)
ref_el
.
text
=
self
.
_node_to_string
(
ref
.
NodeId
)
self
.
aliases
[
ref_name
]
=
ref
.
ReferenceTypeId
.
to_string
()
...
...
tests/tests_xml.py
View file @
2e20a1bc
...
...
@@ -107,8 +107,9 @@ class XmlTests(object):
o20
=
self
.
opc
.
nodes
.
objects
.
add_object
(
20
,
"xmlns20"
)
o200
=
self
.
opc
.
nodes
.
objects
.
add_object
(
200
,
"xmlns200"
)
onew
=
self
.
opc
.
nodes
.
objects
.
add_object
(
new_ns
,
"xmlns_new"
)
vnew
=
onew
.
add_variable
(
new_ns
,
"xmlns_new_var"
,
9.99
)
nodes
=
[
o
,
o2
,
o20
,
o200
,
onew
]
nodes
=
[
o
,
o2
,
o20
,
o200
,
onew
,
vnew
]
self
.
opc
.
export_xml
(
nodes
,
"export-ns.xml"
)
# delete node and change index og new_ns before re-importing
self
.
opc
.
delete_nodes
(
nodes
)
...
...
@@ -121,9 +122,12 @@ class XmlTests(object):
self
.
opc
.
import_xml
(
"export-ns.xml"
)
for
i
in
nodes
[:
-
1
]:
for
i
in
nodes
[:
-
2
]:
i
.
get_browse_name
()
with
self
.
assertRaises
(
uaerrors
.
BadNodeIdUnknown
):
onew
.
get_browse_name
()
onew
.
nodeid
.
NamespaceIndex
+=
1
onew
.
get_browse_name
()
vnew2
=
onew
.
get_children
()[
0
]
self
.
assertEqual
(
vnew
.
nodeid
.
NamespaceIndex
+
1
,
vnew2
.
nodeid
.
NamespaceIndex
)
vnew
.
nodeid
.
NamespaceIndex
+=
1
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