Socket
Socket
Sign inDemoInstall

w3c-xmlserializer

Package Overview
Dependencies
3
Maintainers
6
Versions
13
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    w3c-xmlserializer

A per-spec XML serializer implementation


Version published
Weekly downloads
18M
decreased by-9.62%
Maintainers
6
Install size
82.0 kB
Created
Weekly downloads
 

Package description

What is w3c-xmlserializer?

The w3c-xmlserializer npm package is used to serialize DOM nodes to XML strings, following the W3C specification. It is typically used to convert DOM trees into a format that can be easily transported or stored.

What are w3c-xmlserializer's main functionalities?

Serializing DOM Nodes

This feature allows you to serialize a DOM node (such as an entire document or an individual element) to a string that contains XML. The code sample demonstrates how to create an instance of XMLSerializer and use it to serialize a DOM document to an XML string.

const { XMLSerializer } = require('w3c-xmlserializer');
const serializer = new XMLSerializer();
const xmlString = serializer.serializeToString(document);

Other packages similar to w3c-xmlserializer

Readme

Source

w3c-xmlserializer

An XML serializer that follows the W3C specification.

This module is mostly used as an internal part of jsdom. However, you can use it independently with some care. That isn't very well-documented yet, but hopefully the below sample can give you an idea.

Basic usage

const { XMLSerializer } = require("w3c-xmlserializer");
const { JSDOM } = require("jsdom");

const { document } = new JSDOM().window;
const XMLSerializer = XMLSerializer.interface;
const serializer = new XMLSerializer();
const doc = document.createElement("akomaNtoso");

console.log(serializer.serializeToString(doc));
// => '<akomantoso xmlns="http://www.w3.org/1999/xhtml"></akomantoso>'

Keywords

FAQs

Last updated on 25 Mar 2019

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc