Preserve the XML declaration if it's passed in with the XML, and pretty print it. With tests.