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
Generated on Apr 25, 2024 via pnpm

xpath 0.0.33

DOM 3 XPath implemention and helper for node.js and the web
Package summary
Share
0
issues
1
license
1
MIT
Package created
20 Aug 2012
Version published
14 Jul 2023
Maintainers
2
Total deps
1
Direct deps
0
License
MIT

Issues

0
This package has no issues

Licenses

MIT License

Permissive
OSI Approved
This is a human-readable summary of (and not a substitute for) the license. Disclaimer.
Can
commercial-use
modify
distribute
sublicense
private-use
Cannot
hold-liable
Must
include-copyright
include-license
1 Packages, Including:
xpath@0.0.33
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 xpath 's direct dependencies. Data on all dependencies, including transitive ones, is available via CSV download.
NameVersionSizeLicenseTypeVulnerabilities

Visualizations

Frequently Asked Questions

What does xpath do?

The xpath npm package provides a DOM 3 XPath 1.0 implementation along with helper functions for use with JavaScript, extending support to node.js as well. At its core, it allows for efficient querying and navigation of XML documents.

How do you use xpath?

To use xpath, you first need to install the package via npm using npm install xpath. An xml engine is required in conjunction with xpath, for which the authors recommend xmldom and it can be installed using npm install @xmldom/xmldom.

You can import the necessary modules in your code with require statements: var xpath = require('xpath'); and var dom = require('@xmldom/xmldom').DOMParser;. Then you can use the xpath.select() function to run XPath queries on your XML documents.

Here's an example usage:

var xpath = require('xpath');
var dom = require('@xmldom/xmldom').DOMParser;

var xml = "<book><title>Harry Potter</title></book>";
var doc = new dom().parseFromString(xml, 'text/xml');
var nodes = xpath.select("//title", doc);

console.log(nodes[0].localName + ": " + nodes[0].firstChild.data);
console.log("Node: " + nodes[0].toString());

In this example, xpath.select("//title", doc) is used to select all <title> elements from the XML document.

You can also evaluate string values directly, interact with namespaces, easily map namespaces, and interact with attributes.

Where are the xpath docs?

The xpath package offers comprehensive API documentation which is hosted on GitHub. It provides in-depth information about the different methods and functions provided by the xpath package and their usage.

You can access the xpath API Documentation at this URL: https://github.com/goto100/xpath/blob/master/docs/xpath methods.md.