[Python] Convert xml.etree.ElementTree.Element to lxml.Element

Discussão em 'Python' iniciado por Stack, Fevereiro 27, 2025.

  1. Stack

    Stack Membro Participativo

    I'm developing a package that can be used by both users of lxml and the default xml package. ATM I have a small try:except for the lxml import, but sometimes the user uses functions like dump() from the default xml.etree which don't support the lxml.Element.

    How can I convert between lxml Element and default Element in an efficient way without passing through a string or doing custom recursive processing?

    Continue reading...

Compartilhe esta Página