Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@journeyapps/domparser

Package Overview
Dependencies
Maintainers
2
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@journeyapps/domparser

Basic XML DOM parsing

  • 0.4.1
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
26K
increased by24.4%
Maintainers
2
Weekly downloads
 
Created
Source

domparser

This is a pure JS implementation of DOM parsing, to be used instead of DOMParser in a browser. We use sax.js for the low-level parsing, and convert it to the browser's native Document object, or xmldom.

Why not use the built-in DOMParser?

The built-in DOMParser in modern browsers should be sufficient for most use cases, and has very good performance. However, it does have some limitations:

  1. Error reporting is very different on the different browsers. The browser typically stops after the first error.
  2. It's not possible to get access to position info (what line/column an element is on).

This project aims to be a lightweight replacement for the built-in parser, with better error handling and position reporting.

Usage

const { DOMParser } = require('@journeyapps/domparser');
var doc = new DOMParser().parseFromString("<test>xml</test>");

Supported environments

Should work on any browser that supports ES6.

Tested on recent versions of Node, Chrome and Firefox.

When running in Node, a recent version of xmldom is required.

License

All files in this project are licensed under the MIT license.

FAQs

Package last updated on 28 Dec 2021

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

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc