Movatterモバイル変換


[0]ホーム

URL:


  1. Web
  2. Web APIs
  3. XMLSerializer
  4. XMLSerializer()

XMLSerializer: XMLSerializer() constructor

Baseline Widely available

This feature is well established and works across many devices and browser versions. It’s been available across browsers since ⁨July 2015⁩.

TheXMLSerializer() constructor creates a newXMLSerializer.

Syntax

js
new XMLSerializer()

Parameters

None.

Return value

A newXMLSerializer object.

Examples

Serializing XML into a string

This example serializes an entire document into a string containing XML.

js
const s = new XMLSerializer();const d = document;const str = s.serializeToString(d);saveXML(str);

This involves creating a newXMLSerializer object, then passing theDocument to be serialized intoserializeToString(), which returns the XML equivalent of the document.saveXML() represents a function that would then save the serialized string.

Specifications

Specification
HTML
# dom-xmlserializer-constructor

Browser compatibility

Help improve MDN

Learn how to contribute

This page was last modified on byMDN contributors.


[8]ページ先頭

©2009-2025 Movatter.jp