Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

xmldiff crashes when comparing PI and element #58

Open
laurent-laporte-pro opened this issue Nov 5, 2019 · 1 comment
Open

xmldiff crashes when comparing PI and element #58

laurent-laporte-pro opened this issue Nov 5, 2019 · 1 comment
Labels
enhancement New feature or request

Comments

@laurent-laporte-pro
Copy link

xmldiff crashes when it compares a processing-instruction with an element.

Using xmldiff v2.4 and lxml v4.4.1

Unit test:

import xmldiff.main
from lxml import etree


def test_xml_diff():
    xmldiff.main.diff_trees(
        etree.XML("<ROOT><?pi?></ROOT>"), etree.XML("<ROOT><ie/></ROOT>"))

Result:

test_xmldiff.py:4 (test_xml_diff)
test_xmldiff.py:6: in test_xml_diff
    xmldiff.main.diff_trees(etree.XML("<ROOT><?pi?></ROOT>"), etree.XML("<ROOT><ie/></ROOT>"))
../../virtualenv/tmp/lib/site-packages/xmldiff/main.py:28: in diff_trees
    return list(diffs)
../../virtualenv/tmp/lib/site-packages/xmldiff/diff.py:439: in diff
    for action in self.update_node_tag(lnode, rnode):
../../virtualenv/tmp/lib/site-packages/xmldiff/diff.py:233: in update_node_tag
    left.tag = right.tag
E   AttributeError: attribute 'tag' of 'lxml.etree._ProcessingInstruction' objects is not writable
@regebro regebro added the enhancement New feature or request label Jan 12, 2023
@regebro
Copy link
Contributor

regebro commented Jan 12, 2023

It will crash with any sort of processing instruction AFAIK.
See #78

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants