1.2.0 • Published 3 years ago

@ebcom/xmlparser v1.2.0

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

@ebcom/xml-parser

Fast and Simple XML Parser for parsing xml to json objects.

Installation

npm i @ebcom/xmlparser

How to use

const ebcomXmlParser = require('@ebcom/xmlparser');

//create an instance of parser with some options (if u want to use it globally in your project)
const parser = ebcomXmlParser({returnAttributeAsArray: true, throwErrorIfXmlNotValid: true});

const xml = `<note>
<to>Tove</to>
<from>Jani</from>
<heading>Reminder</heading>
<body>Don't forget me this weekend!</body>
</note>`

const jsonObject = parser.parse(xml); //return a json object, simple as that :)