The DOMParser interface provides the ability to parse XML or HTML source code from a string into a DOM Document.
DOMParser
The XMLSerializer interface provides the serializeToString() method to construct an XML string representing a DOM tree.
XMLSerializer