For example:
<root xmlns:ns1="http://example.com/ns1" xmlns:ns2="http://example.com/ns2">
<ns1:child attr="value">
<ns2:subchild>Content</ns2:subchild>
</ns1:child>
</root>
If I parse this xml and then call to_xml on either the child or subchild elements, I get an xml that doesn't include the namespace definitions, since they were defined on the root element.
How can I serialize those elements including the namespace definitions?