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

Missing XMLParser options WITHOUT deprecated solution #103

Open
dga-nagra opened this issue Nov 14, 2023 · 1 comment
Open

Missing XMLParser options WITHOUT deprecated solution #103

dga-nagra opened this issue Nov 14, 2023 · 1 comment

Comments

@dga-nagra
Copy link

Hi,

Sorry for re-creating a new issue but it seems that you are not seeing closed ones.
It the #102 issue, the solution proposed is depracted as stated in #33 .
This solution should therefore not be used and it won't be accepted by CI/CD.
For reminder, the solution was the following:

>>> import lxml.etree
>>> import defusedxml.lxml
>>>
>>> parser = lxml.etree.Parser(remove_blank_text=True, resolve_entities=False)
>>> lookup = lxml.etree.ElementDefaultClassLookup(defusedxml.lxml.RestrictedElement)
>>> parser.set_element_class_lookup(lookup)
>>> e = defusedxml.lxml.XML("<root><el/>  </root>", parser=parser)
>>> lxml.etree.tostring(e)
b'<root><el/></root>'

The main point of the solution proposed is the use of the defused.lxml.RestrictedElement , then defused.lxml.XML which are only part of the defused.lxml module.

There should be a non-deprecated way of doing it. If another solution exists that is not deprecated, then I would gladly be informed of it. Otherwise, the solutions are to:

  • Remove lxml deprecation
  • Move the necessary to another non-deprecated module
  • Match the official lxml library's API

Please, don't close this issue right away after responding.
Thank you.

@dga-nagra
Copy link
Author

Hi @tiran , since the issue #102 and #33 were answer by you, do you have any feedback on this?

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

No branches or pull requests

1 participant