Write the object to an xml stream. The object is expected to write itself and its children.
The stream to write to.