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

Use lxml's adoptExternalDocument() #239

Open
scoder opened this issue Oct 10, 2022 · 0 comments
Open

Use lxml's adoptExternalDocument() #239

scoder opened this issue Oct 10, 2022 · 0 comments

Comments

@scoder
Copy link
Contributor

scoder commented Oct 10, 2022

It seems that xmlsec's lxml integration does not call adoptExternalDocument() to create an lxml wrapper for an internally created libxml2 XML tree. If it wants to pass externally created XML documents into lxml, then it should call it. Simply wrapping an arbitrary libxml2 tree in an lxml Element violates lxml's tree invariants, such as shared usage of an XML name dict. This can lead to misbehaving elements, such as missing results from .find() (see https://bugs.launchpad.net/lxml/+bug/1960668).

https://github.com/lxml/lxml/blob/95f8006336889df154c45130db1ec897b424e529/src/lxml/includes/etreepublic.pxd#L64-L65

I admit that this is probably un(der)documented, so not your fault.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants