XML DOM - XMLSerializer object

Serialize XML documents and nodes.

XMLSerializer object

Constructor

new XMLSerializer()

Description

The XMLSerializer object allows you to convert an XML document or Node object into or 'serialize' it into a string of unparsed XML marks.

To use an XMLSerializer, instantiate it with a constructor without parameters, and then call its serializeToString() method:

var text = (new XMLSerializer()).serializeToString(element)

IE does not support the XMLSerializer object. Instead, it makes XML text available through the xml attribute of the Node object.

See also:Node.xml

XMLSerializer.serializeToString()

Convert an XML document or node to a string

Syntax

serializeToString(node)

The node parameter is the XML node to be serialized. This could be a Document ObjectOr any Element.

Return Value

A string representing the serialized form of a specified node and all its descendants, an XML mark.