Call SaveToStream to save the XML document to the Stream. Stream can be any TStream descendant. Set
XmlFormat to xfReadable if you want the stream to contain indentations to make the XML more human-readable. This is not the default and also not compliant with the XML specification. See
SaveToFile for information on how to save in special encoding.