Home
Docs
GitHub
Pricing
Blog
Log In

Run Sandworm Audit for your App

Get started
Hold on, we're currently generating a fresh version of this report
This package has been deprecated with the following message: Deprecated due to CVE-2021-21366 resolved in 0.5.0
Generated on May 18, 2024 via pnpm

xmldom 0.1.30

A W3C Standard XML DOM(Level2 CORE) implementation and parser(DOMParser/XMLSerializer).
Package summary
Share
7
issues
2
critical severity
vulnerability
2
1
high severity
meta
1
4
moderate severity
vulnerability
4
1
license
1
(LGPL-2.0 or MIT)
Package created
6 Jan 2012
Version published
19 Dec 2019
Maintainers
2
Total deps
1
Direct deps
0
License
(LGPL-2.0 or MIT)

Issues

7

2 critical severity issues

critical
Recommendation: None
via: xmldom@0.1.30
Recommendation: None
via: xmldom@0.1.30
Collapse
Expand

1 high severity issue

high
via: xmldom@0.1.30
Collapse
Expand

4 moderate severity issues

moderate
Recommendation: Upgrade to version 0.5.0 or later
via: xmldom@0.1.30
Recommendation: None
via: xmldom@0.1.30
Recommendation: Upgrade to version 0.5.0 or later
via: xmldom@0.1.30
Recommendation: None
via: xmldom@0.1.30
Collapse
Expand

Licenses

(LGPL-2.0 or MIT)

Permissive
1 Packages, Including:
xmldom@0.1.30
Disclaimer

This deed highlights only some of the key features and terms of the actual license. It is not a license and has no legal value. You should carefully review all of the terms and conditions of the actual license before using the licensed material.

Sandworm is not a law firm and does not provide legal services. Distributing, displaying, or linking to this deed or the license that it summarizes does not create a lawyer-client or any other relationship.

Direct Dependencies

0
All Dependencies CSV
β“˜ This is a list of xmldom 's direct dependencies. Data on all dependencies, including transitive ones, is available via CSV download.
NameVersionSizeLicenseTypeVulnerabilities

Visualizations

Frequently Asked Questions

What does xmldom do?

XMLDOM is a JavaScript-based module that adheres to the W3C standard. It primarily implements the DOMParser and XMLSerializer interface in a similar way as in the browser. This makes it an ideal solution for manipulating XML documents within various JavaScript environments, such as Node.js, Rhino, and others. The functionality provided by the xmldom package ranges from basic operations like parsing an XML string into an XML Document object (DOM), modifying that document, and then serializing it back into an XML string. By achieving full compatibility with W3C's DOM level 2, and some compatibility with level 3, xmldom ensures adherence to standardized practices for XML document handling.

How do you use xmldom?

To use xmldom in your JavaScript project, first, you need to install it using npm, as shown below:

npm install xmldom

Then, you can import the package and use it in your code. Here's an example of how you can parse an XML string into a DOM and then work with it:

const { DOMParser } = require('xmldom');

const doc = new DOMParser().parseFromString(
    '<xml xmlns="a" xmlns:c="./lite">\n' +
        '\t<child>test</child>\n' +
        '\t<child></child>\n' +
        '\t<child/>\n' +
        '</xml>',
    'text/xml'
);
doc.documentElement.setAttribute('x', 'y');
doc.documentElement.setAttributeNS('./lite', 'c:x', 'y2');
console.info(doc);

const nsAttr = doc.documentElement.getAttributeNS('./lite', 'x');
console.info(nsAttr);

You can also serialize an XML document back into a string using the XMLSerializer:

const { DOMParser, XMLSerializer } = require('xmldom');

const doc = new DOMParser().parseFromString('<root/>', 'text/xml');
const serializer = new XMLSerializer();
const xmlStr = serializer.serializeToString(doc);
console.info(xmlStr); // logs: <root/>

These examples show basic usage, but xmldom provides a full suite of methods for interacting with XML documents, including methods for CRUD operations on XML nodes, handling XML namespaces, dealing with XML errors, and more.

Where are the xmldom docs?

The documentation for xmldom is available both directly within the npm package details page and on the GitHub repository. The docs detail the API reference, including the DOMParser and XMLSerializer interfaces, as well as other aspects like DOM level 2 methods and attributes, DOM level 3 support, and exceptions. The xmldom documentation is a comprehensive guide that assists users with different levels of XML manipulation, providing both conceptual understanding and practical usage examples.