Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions module_utils/network/ne/common_module/xml_build_with_xmlns.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,9 @@ def create_xml_with_xmlns(root, new_xmlns_info_list, all_xpath_without_prefix, d
:param dest_xpath: record the path of rebuild
:param current_element: the current generate element root
"""
if root.getchildren():
if list(root):
# traversing the xml root which need to be rebuild.( always come from instance xml )
for child_of_root in root.getchildren():
for child_of_root in list(root):
dest_xpath = dest_xpath + "/" + child_of_root.tag

# get value from instance xml
Expand Down Expand Up @@ -133,4 +133,4 @@ def xml_parser_join_xmlns(xml_content, xmlns_info_list, filter_or_config_type):
xml_str = ET.tostring(generate_root, method='xml')
else:
xml_str = ET.tostring(generate_root, method='xml', encoding="utf-8").decode('utf-8')
return xml_str
return xml_str