Socket
Socket
Sign inDemoInstall

xmldom

Package Overview
Dependencies
0
Maintainers
1
Versions
36
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    xmldom

A W3C Standard based DOMParser and XMLSerializer (DOM Level2 CORE).


Version published
Weekly downloads
1.2M
decreased by-15.69%
Maintainers
1
Created
Weekly downloads
 

Package description

What is xmldom?

The xmldom npm package is a pure JavaScript W3C standard-based (XML DOM Level 2 Core) DOMParser and XMLSerializer module. It allows users to parse XML data into a DOM tree structure and serialize DOM trees back into XML. This package is particularly useful for server-side applications where DOM manipulation is needed without a browser environment.

What are xmldom's main functionalities?

Parsing XML to DOM

This feature allows you to parse a string of XML into a DOM tree, enabling programmatic access and manipulation of the structure and content.

const { DOMParser } = require('xmldom');
const xmlString = '<root>Hello World</root>';
const doc = new DOMParser().parseFromString(xmlString, 'text/xml');
console.log(doc.documentElement.nodeName); // 'root'

Serializing DOM to XML

This feature enables you to take a DOM tree and serialize it back into a string of XML, useful for outputting modified XML data.

const { XMLSerializer } = require('xmldom');
const doc = new DOMParser().parseFromString('<root>Hello World</root>', 'text/xml');
const xmlString = new XMLSerializer().serializeToString(doc);
console.log(xmlString); // '<root>Hello World</root>'

Other packages similar to xmldom

Keywords

FAQs

Last updated on 06 Jan 2012

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