Name

XMLSerializer: serializes XML documents and nodes — Firefox 1.0, Safari 2.01, Opera 7.60: Object → XMLSerializer

Constructor

new XMLSerializer( )

Methods

serializeToString( )

This instance method performs the actual serialization.

Description

An XMLSerializer object enables you to convert or “serialize” an XML Document or Node object to a string of unparsed XML markup. To use an XMLSerializer, instantiate one with the no-argument constructor, and then call its serializeToString( ) method:

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

Internet Explorer does not support the XMLSerializer object. Instead, it makes XML text available through the xml property of the Node object.

See Also

DOMParser, Node; Chapter 21

Get JavaScript: The Definitive Guide, 5th Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.