
Is there a way of telling etree to iterate only over the immediate children of an element? I know I can do it by enumerating the elements that occur as chid element. In my particular case, it would be simpler if I could exclude elements, as in "cycle through everything except 'w', 'c', and 'pc'. On But it would be more elegant to say "cycle through the elements just one level below the current element". Is that possible? One possibility might be to use the getchildren() function, but I'm not sure whether that's the best way.

Martin,
Is there a way of telling etree to iterate only over the immediate children of an element?
There's the Element's iterchildren() method (and several other iter* methods that basically cover the main XPath axes) Holger Landesbank Baden-Wuerttemberg Anstalt des oeffentlichen Rechts Hauptsitze: Stuttgart, Karlsruhe, Mannheim, Mainz HRA 12704 Amtsgericht Stuttgart
participants (2)
-
Holger Joukl
-
Martin Mueller