XMLSerializer().serializeToString() is a simple useful HTML2XML Converter.
XMLSerializer().serializeToString()
method converts DOM tree to text.
On Firefox, the output text is well-formed XML source code.
The source DOM tree can be HTML.
If XMLSerializer().serializeToString()
is applied to a HTML document,
it returns a XML-converted source code.
For example, img
elements ("<img ...>
") are converted to the XML's empty-element tag form : "<img ... />
"