Shoobx / xmldiff

A library and command line utility for diffing xml

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Comment ignored

pieterhartel opened this issue · comments

The first section of code below returns the empty list, but it should produce an insert action:

from xmldiff import main
print( main.diff_texts( '<html></html>', '<html></html><!--comment-->' ) )

The second section of code below is correct in that it produces [InsertComment(target='/html[1]', position=0, text='comment')]:

from xmldiff import main
print( main.diff_texts( '<html></html>', '<html><!--comment--></html>' ) )

$ py -m pip list
xmldiff 2.4

xmldiff uses lxml which returns the root node of the document. Any comments outside that root node will be ignored. I can't see any way of changing that.