Socket
Socket
Sign inDemoInstall

xml-slicer

Package Overview
Dependencies
2
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    xml-slicer

slice XML stream using XPath expression


Version published
Weekly downloads
1
Maintainers
1
Created
Weekly downloads
 

Readme

Source

XmlSlicer

Slice XML stream using XPath expression

Supported XPath constructs are:

  • '/'-axis (child)
  • '//'-axis (self-or-descendant)
  • node name tests, including namespaces
  • all nodes selector: '*'
  • predicate test:
  • @attribute_name = "literal"

Usage

Instantiate a new XmlSlicer stream and pipe a XML into it. Then XmlSlicer will emit data events on each XPath match. Prior to pass further down the pipe XML fragment can be somehow parsed using internal _XmlSlicer.parse method.

Example

An example of how to use this library is as follows:

var fs = require('fs');
var XmlSlicer = require('xml-slicer');

var fileStream = fs.createReadStream('bookstore.xml');
var xmlSLicer = XmlSlicer({xpath: '//book'});
fileStream.pipe(xmlSLicer).pipe(process.stdout);

Check out the examples directory for more usage examples.

To-do list

  • write tests

FAQs

Last updated on 16 Jan 2016

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