Stefan Behnel wrote:
Hi all,
Stefan Behnel wrote:
What bothers me is that lxml is consistent with ElementTree in that it adds whitespace around comment texts. I have no idea why ElementTree does that in the first place. AFAICT, this happily breaks things like SSI.
I took a second look at this and found that lxml can't actually support this. Since the parser does not ignore comments (as ET does) and since we don't serialise on our own, we can't make sure that we always add spaces around the comment text. We can do that through the API calls to Comment(), but that would make things inconsistent compared to parsed trees.
Right, I recall looking into that long ago and coming to the same conclusion. I should've marked that in the compatibility file. Regards, Martijn