
you were not supposed to merge this patch so soon :)
there are two unresolved issues, one was posted in another thread, the other is this one, directly related.
On 09/15/14 15:21, Stefan Behnel wrote:
I also noticed that html.tostring doesn't suppress namespaces, but my
patch does. Should I alter that behaviour?
I was referring to the xf.element() calls (sorry). If people write out subtrees as HTML that use namespaces somewhere, I think they're pretty much on their own.
However, I think it should be an error if you try that directly with xf.element() in HTML mode.
with etree.htmlfile(self._file) as xf: xf.write(etree.Element('{some_ns}some_tag'))
doesnt suppress namespaces
with etree.htmlfile(self._file) as xf: with xf.element("{some_ns}some_tag"): pass
does suppress namespaces. this is inconsistent and needs to be fixed.
see: https://github.com/plq/lxml/commit/378408d2b6e94a4c91410fc7bde5bba055f54785
You have three options:
1) silently filter namespaces out 2) throwing an exception when using html serialization with namespaced elements 3) let namespaces pass
I'd choose 1 to make the lives of people who generate xhtml and html with the same code easier.
It's your decision though.
Best, Burak