Fixes various issues like garbage output with lxml.etree.tostring like the following example.
>>> from lxml import etree >>> node = etree.XML("<foo><bar>baz</bar>\n<bar>qux</bar></foo>") >>> print(etree.tostring(node)) b'<foo><bar>baz</bar>\n<bar>qux</bar></foo>' >>> print(etree.tostring(node.getchildren()[0])) b'<bar>baz</bar>\n<bar>qux</bar></foo>\n' >>> print(etree.tostring(node.getchildren()[1])) b'<bar>qux</bar></foo>'
After the patches I get the expected results.
>>> from lxml import etree >>> node = etree.XML("<foo><bar>baz</bar>\n<bar>qux</bar></foo>") >>> print(etree.tostring(node)) b'<foo><bar>baz</bar>\n<bar>qux</bar></foo>' >>> print(etree.tostring(node.getchildren()[0])) b'<bar>baz</bar>\n' >>> print(etree.tostring(node.getchildren()[1])) b'<bar>qux</bar>'
Signed-off-by: Martin Reboredo <yakoyoku@gmail.com>