xpath-stream
xpath transform stream
Install
$ npm install xpath-stream
Usage
var xpathStream = ; // string streamvar Readable = Readable;{ var stream = objectMode:true; stream; stream; return stream}; var xml = ; // text nodexml ; // attribute valuexml ; // xmldom objectxml ; // objectxml;
Bonus
$ npm install -g xpath-stream
then
$ xpath-stream "//root/node()" < test.xml
or
$ cat test.xml | xpath-stream "//articles/article[position()=1]/node()"
with namespace
$ xpath-stream --namespace=ns:http://example.com/ns "//ns:item[@ns:id='5A23']" < ./test/test.xml