An open API service indexing awesome lists of open source software.

https://github.com/kessler/simple-xml-parser

More of an extractor than a parser. This library should only be used on small xml data, that is expected to be mostly well formed. It should be very fast for this niche.
https://github.com/kessler/simple-xml-parser

Last synced: about 2 months ago
JSON representation

More of an extractor than a parser. This library should only be used on small xml data, that is expected to be mostly well formed. It should be very fast for this niche.

Awesome Lists containing this project

README

        

simple xml parser
=================

More of an extractor than a parser. This library should only be used on small xml data, that is expected to be mostly well formed. It should be very fast for this niche.
Please note that element data is extracted from the first element the parser encounters and in the order it was declared.

### Usage

```
var xml = 'xml';

var SimpleXmlParser = require('simple-xml-parser');

var parser = SimpleXmlParser.create(['x', 'm', 'l']);

var result = parser.parseData(xml);

if (result.error) {
console.log(result.error, result.element);
} else {
console.log(result.parsedData.x);
console.log(result.parsedData.m);
console.log(result.parsedData.l);

// prints:
// x
// m
// l
}

```