Socket
Socket
Sign inDemoInstall

@xml-tools/parser

Package Overview
Dependencies
2
Maintainers
3
Versions
20
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @xml-tools/parser

XML Parser Implemented in JavaScript


Version published
Weekly downloads
178K
decreased by-14.65%
Maintainers
3
Install size
2.21 MB
Created
Weekly downloads
 

Readme

Source

npm (scoped)

@xml-tools/parser

A Fault Tolerant XML Parser which produces a Concrete Syntax Tree.

This means that the Parser will not stop on the first error and instead attempt to perform automatic error recovery. This also means that the CST outputted by the Parser may only have partial results. For example, In a valid XML an attribute must always have a value, however in the CST produced by this parser an attribute's value may be missing as the XML Text input is not necessarily valid.

The CST produced by this parser is often used as the input for other packages in the xml-tools scope, e.g:

Installation

With npm:

  • npm install @xml-tools/parser

With Yarn

  • yarn add @xml-tools/parser

Usage

Please see the TypeScript Definitions for full API details.

A simple usage example:

const { parse } = require("@xml-tools/parser");

const xmlText = `<note>
                     <to>Bill</to>
                     <from>Tim</from>
                 </note>
`;

const { cst, lexErrors, parseErrors } = parse(xmlText);
console.log(cst.children["element"][0].children["Name"][0].image); // -> note

Support

Please open issues on github.

Contributing

See CONTRIBUTING.md.

Keywords

FAQs

Last updated on 03 Jun 2021

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