Assign parent when assigning children
When assigning children, assign their parents too.
This is necessary because to_xml
would traverse the DOM and compare against the root node, and without the correct parent node, this traversal will never stop.
Edited by Mark Chao