Q:

Why can't I just delete parents or clear the root node in iterparse()?

1
Like
Answer
Comment
Flag
Thanks for your feedback!
A:

1 Answer

rank
1
Like
Comment
Flag
The iterparse() implementation is based on the libxml2 parser. It requires the tree to be intact to finish parsing. If you delete or modify parents of the current node, chances are you modify the structure in a way that breaks the parser. Normally, this will result in a segfault. Please refer to the iterparse section of the lxml API documentation to find out what you can do and what you can't do.  more
codespeak.net

Related Videos

Add your answer...

Top Answerers

1.
Cheap SSL Certificates
7 Answers in the past week
2.
vanity fair
7 Answers in the past week
3.
Robert Turner
4 Answers in the past week

Top Askers

1.
Frank Bell
2 Questions in the past week
2.
Frank Bigaglow
3 Questions in the past week
3.
Charles McAtee
2 Questions in the past week

Top Supporters

1.
Tom Wagner
9 Likes given in the past week
2.
Susan Brunner
3 Likes given in the past week
3.
CableAnd OtherThings Too
2 Likes given in the past week
...