xml-slicer
slice XML stream using XPath expression
Last updated 4 years ago by lauris .
ISC · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install xml-slicer 
SYNC missed versions from official npm registry.

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

Current Tags

  • 1.0.0                                ...           latest (4 years ago)

1 Versions

  • 1.0.0                                ...           4 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 1
Dependencies (2)
Dev Dependencies (1)
Dependents (1)

Copyright 2014 - 2016 © taobao.org |