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.
- Host: GitHub
- URL: https://github.com/kessler/simple-xml-parser
- Owner: kessler
- Created: 2013-02-03T19:44:16.000Z (about 12 years ago)
- Default Branch: master
- Last Pushed: 2013-11-21T11:23:36.000Z (over 11 years ago)
- Last Synced: 2025-03-08T08:12:40.958Z (about 2 months ago)
- Language: JavaScript
- Size: 113 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
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
}```