Hi Xavier,

Am 07.03.2022 13:27 schrieb Xavier Morel:
As can be seen here, both the html parser and the objectify parser
seem to complete lose their "magic".

Is there a "proper" way to make these things collaborate?

I've recently wondered the same and started experimenting on how to combine custom class lookup and lxml.objectivy, see this gist [0]. It doesn't use ElementDefaultClassLookup but ElementNamespaceClassLookup, but maybe it's still relevant.

The essence to make it work was
- set objectify.ObjectifyElementClassLookup() as fallback in our custom lookup scheme, so that tree nodes get "objectivied" (L. 56) - create new elements via custom parser, because only the parsers knows about the custom lookup scheme (L. 94, 98)

I'm lxml newbie, maybe some more experienced folks here can review the code and tell if it's a "proper way"? Would appreciate some feedback.

Cheers
Tobias

[0] https://gist.github.com/haxtibal/8bfc6d32915c7c434e1bc91d016de916
_______________________________________________
lxml - The Python XML Toolkit mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/lxml.python.org/
Member address: [email protected]

Reply via email to