co-xml2js

node-xml2js with co

Usage no npm install needed!

<script type="module">
  import coXml2js from 'https://cdn.skypack.dev/co-xml2js';
</script>

README

co-node-xml2js

node-xml2js with co

Usage

install from npm

npm install co-xml2js
import xml2js from "xml2js";
import co from "co";

co(function *() {

    var xml = new xml2js.Builder().buildObject({
        xml: {
            div: "text"
        }
    });

    var json;

    // parse xml
    json = yield xml2js.parseString(xml);
    // or
    var parser = new xml2js.Parser(/*your options*/);
    json = yield parser.parseString(xml);

});