function(file) {
    var xml = file.contents;
    var xmlDoc = libxmljs.parseXml(xml);
    var rootNode = xmlDoc.root();

    var resourceObject = {};
    var valueNodes = rootNode.find("data");
    valueNodes.forEach(function(element) {
      var name = element.attr("name").value();
      var value = element.get("value").text();
      resourceObject[name] = value;
    });

    return JSON.stringify(resourceObject);
  }
function(file) {
    var xml = file.contents;
    var xmlDoc = libxmljs.parseXml(xml);
    var rootNode = xmlDoc.root();

    var resourceObject = {};
    var valueNodes = rootNode.find("data");
    valueNodes.forEach(function(element) {
      var name = element.attr("name").value();
      var value = element.get("value").text();
      resourceObject[name] = value;
    });

    return JSON.stringify(resourceObject);
  }
function ( file ) { var xml = file . contents ; var xmlDoc = libxmljs . parseXml ( xml ) ; var rootNode = xmlDoc . root ( ) ; var resourceObject = { } ; var valueNodes = rootNode . find ( "data" ) ; valueNodes . forEach ( function ( element ) { var name = element . attr ( "name" ) . value ( ) ; var value = element . get ( "value" ) . text ( ) ; resourceObject [ name ] = value ; } ) ; return JSON . stringify ( resourceObject ) ; }
Convert XML to JSON
Convert XML to JSON