Some time ago wrote an XML DOM-based XMLWRITER, in several ways, no packages;
If you have experience, please help me to expand: