Blazing fast XML parser to JSON written in Rust (node2object).
rust
cargo
node-gyp requirements
const parser = require('parser-xml2json')
const xml = `
<population>
<entry>
<name>Alex</name>
<height>173.5</height>
</entry>
<entry>
<name>Mel</name>
<height>180.4</height>
</entry>
</population>
`
parser.parseString(xml, (err, res) => {
...
})
parser.parseFile('/a/xml/file/somewhere.xml', { object: true }, (err, res) => {
...
})
xmlString
- A string that represents an XMLoptions
- an optional object where:object
- Parse JSON string to Object. defaultfalse
callback
- a function with the signaturefunction (err, result)
filePath
- Relative or absolute path to an.xml
fileoptions
- an optional object where:object
- Parse JSON string to Object. defaultfalse
callback
- a function with the signaturefunction (err, result)
Results from a i7 2.2 Ghz
Package Time taken
---------------------- ----------
parser-xml2json (rust) 0.0468 s
xml2js (js) 0.1286 s
xml2json (js and c++) 0.1329 s
npm i
npm i benchmark/
node benchmark/index.js
MIT