[lxml-dev] An lxml tree inside a lxml tree.

Albert Brandl albert.brandl at tttech.com
Wed Mar 26 13:34:07 CET 2008


On Wed, Mar 26, 2008 at 12:07:09PM +0100, Stefan Behnel wrote:
> I added an answer here:
> 
> https://answers.launchpad.net/lxml/+question/28032

I finally got it ;-). It was not clear to me that lxml only _adds_ whitespace 
when appropriate, neither what "appropriate" actually means. If I understand 
your explanation correctly, the pretty-printing algorithm leaves alone any 
elements that already contain whitespace - this corresponds to the behavior 
in my example, and your method of removing leading and trailing whitespace
will help in most cases.

Thanks,

Albert


More information about the lxml-dev mailing list