Shoobx / xmldiff

A library and command line utility for diffing xml

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Exception diffing files with processing instructions

gnarlyfarley opened this issue · comments

xmldiff_error.zip

When diffing the two files contained in the attached zip file, I get the following exception:

Traceback (most recent call last):
File "", line 1, in
File "C:\Users\lafarley\AppData\Local\Programs\Python\Python36\lib\site-packages\xmldiff\main.py", line 51, in diff_files
diff_options=diff_options, formatter=formatter)
File "C:\Users\lafarley\AppData\Local\Programs\Python\Python36\lib\site-packages\xmldiff\main.py", line 39, in _diff
formatter=formatter)
File "C:\Users\lafarley\AppData\Local\Programs\Python\Python36\lib\site-packages\xmldiff\main.py", line 28, in diff_trees
return list(diffs)
File "C:\Users\lafarley\AppData\Local\Programs\Python\Python36\lib\site-packages\xmldiff\diff.py", line 439, in diff
for action in self.update_node_tag(lnode, rnode):
File "C:\Users\lafarley\AppData\Local\Programs\Python\Python36\lib\site-packages\xmldiff\diff.py", line 233, in update_node_tag
left.tag = right.tag
File "src\lxml\etree.pyx", line 992, in lxml.etree._Element.tag.set
File "src\lxml\apihelpers.pxi", line 1657, in lxml.etree._getNsTag
File "src\lxml\apihelpers.pxi", line 1675, in lxml.etree.__getNsTag
File "src\lxml\apihelpers.pxi", line 1538, in lxml.etree._utf8
TypeError: Argument must be bytes or unicode, got 'cython_function_or_method'

We currently do not support XML Processing instructions. We should.

Investigating a bit, diffing does work, but the xml formatter fails. To fix this we likely do have to handle processing instructions differently in the diffing itself, specifically we should never rename a normal node to a processing instruction.