Sorry for the delay, I missed your answer.
Indeed it makes sense to try to keep the trees normalized. It should also be more efficient than doing it "after the fact". I have to go through the (long!) list of methods and see which ones would need to check. Beyond cut and unwrap (erase is just an alias for unwrap) and methods which use those, I can think of set_tag (if you set to '#PCDATA'), set_content maybe (I have to check). I'll let you know when I have an updated version.
Thanks for the idea
(6)
]
