JavaScript XML library
ltx is a fast XML builder, parser, serialization and manipulation library for JavaScript.
The builder is a convenient and succinct API to build XML documents represented in memory as JavaScript primitives that can be serialized to XML strings.
The parser can parse XML documents or streams and support multiple parsers.
Features:
- succinct API to build and manipulate XML objects
- parse XML strings
- parse XML streams
- multiple parser backends
- JSX compatible (with
ltx.createElement
pragma) - tagged template support
ltx`<foo bar="${baz}">`
npm install ltx
By default ltx uses its own parser which is the fastest but doesn't support advanced XML features. ltx supports third party parsers when such features are needed.
parser | ops/sec | native | stream |
---|---|---|---|
sax-js | 99,412 | ☐ | ☑ |
node-xml | 130,631 | ☐ | ☑ |
libxmljs | 276,136 | ☑ | ☐ |
node-expat | 322,769 | ☑ | ☑ |
ltx/lib/parsers/ltx | 641,327 | ☐ | ☑ |
From ltx/benchmarks/parsers.js, higher is better.
http://node-xmpp.org/doc/ltx.html
npm run benchmark
npm install
npm test