Commit 3cc702ba authored by Nicolas Delaby's avatar Nicolas Delaby

Exclude comments or processing instruction as sibling node

parent 1692fd42
......@@ -229,8 +229,20 @@ class ERP5Diff:
len_total_child_list = len(parent_element)
last_append_element = None
for element in element_list:
relative_next = element.getnext()
relative_previous = element.getprevious()
# get only elements not something else (PI and comments are ignored)
# XXX May be support of PI and Comments should be added
# in this case fallback to previous code
# relative_next = element.getnext()
relative_next_list = element.xpath('following-sibling::*[1]')
if relative_next_list:
relative_next = relative_next_list[0]
else:
relative_next = None
relative_previous_list = element.xpath('preceding-sibling::*[1]')
if relative_previous_list:
relative_previous = relative_previous_list[0]
else:
relative_previous = None
if relative_previous in element_list:
#reuse same container as preceding
append_element = last_append_element
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment