On 21 Jan 2024, at 12:42, Stefan Behnel wrote:

Hi Stefan,

> If you want to avoid creating element objects all together, maybe even don't 
> need a full (sub-)tree structure to get all relevant information, I suggest 
> you try the low-level SAX interface.
>
> https://lxml.de/parsing.html#the-target-parser-interface
>
> It's quite efficient and usable for locally constrained XML transformations, 
> e.g. filtering elements or attributes.
>
> And you can still parse input chunk by chunk, if you need that:
>
> https://lxml.de/parsing.html#the-feed-parser-interface

Yes, I've read about both of those but always shied away from them. The ETree 
interface really is a join to work with and in most cases all you need but I 
guess I've come across the two edge-cases where the performance overhead can be 
considered an issue.

On a slightly related note, is there anyway getting the parser to treat some 
attributes as numbers to avoid casting in Python?

Charlie

--
Charlie Clark
Managing Director
Clark Consulting & Research
German Office
Sengelsweg 34
Düsseldorf
D- 40489
Tel: +49-203-3925-0390
Mobile: +49-178-782-6226
_______________________________________________
lxml - The Python XML Toolkit mailing list -- lxml@python.org
To unsubscribe send an email to lxml-le...@python.org
https://mail.python.org/mailman3/lists/lxml.python.org/
Member address: arch...@mail-archive.com

Reply via email to