🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
DemoInstallSign in
Socket

xmldoc

Package Overview
Dependencies
Maintainers
1
Versions
25
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

xmldoc

A lightweight XML Document class for JavaScript.

2.0.0
Source
npm
Version published
Weekly downloads
1.6M
6.44%
Maintainers
1
Weekly downloads
 
Created

What is xmldoc?

The xmldoc npm package is a lightweight XML parser that provides an easy and manageable way to parse XML documents and navigate their structures in Node.js applications. It allows users to load XML documents as objects and access their attributes, child elements, and text content programmatically.

What are xmldoc's main functionalities?

Parsing XML

This feature allows the parsing of XML strings into a manageable object structure, enabling easy access to different parts of the XML document.

var XmlDocument = require('xmldoc').XmlDocument;
var xml = new XmlDocument('<root><child foo="bar">Hello, world!</child></root>');
console.log(xml.firstChild.attr.foo); // outputs: bar

Navigating Nodes

This feature enables navigation to specific nodes by their names and retrieval of their text content.

var child = xml.childNamed('child');
console.log(child.val); // outputs: Hello, world!

Accessing Attributes

This feature allows access to the attributes of XML nodes, making it easy to retrieve values associated with different attributes in an element.

console.log(xml.firstChild.attr.foo); // outputs: bar

Other packages similar to xmldoc

Keywords

xml

FAQs

Package last updated on 05 Apr 2025

Did you know?

Socket

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