node-xml-lite2
A stripped down fork of https://github.com/hgourvest/node-xml-lite
- This is a pure javascript XML SAX parser for Node.js.
- The specificity of this xml parser is that it can parse a document from a Buffer.
- It relies on iconv-lite to decode the text according to the code page of the document.
Differences from node-xml-lite
- Removed all
SAXParse*
API variants until I have time to rewrite them into aparseStream
API - Exported the raw
XmlParser
class to allow for custom, lightweight parsing jobs (somewhat making up for the removal of theSAXParse*
APIs) - Added TypeScript definition file
- Added an
offset
property to the parser to complementline
+col
Installation
npm install node-xml-lite2
Sample usage
Parse a file
var xml = ;xml;
Parse a file synchronously
var xml = ;var root = xml;
Parse a string
var xml = ;xml;
Parse a buffer
var xml = ;xml;
Advanced usage
Custom parsing
var xml = ;var parser = ;var buffer = fs; parser;