scripts/lib/xmlHelper.js
function writeJsonAsXml(jsData, filePath, options) {
  var xmlBuilder = new xml2js.Builder(options);
  var changedXmlData = xmlBuilder.buildObject(jsData);
  var isSaved = true;

  try {
    fs.writeFileSync(filePath, changedXmlData);
  } catch (err) {
    console.log(err);
    isSaved = false;
  }

  return isSaved;
}
function writeJsonAsXml(jsData, filePath, options) {
  var xmlBuilder = new xml2js.Builder(options);
  var changedXmlData = xmlBuilder.buildObject(jsData);
  var isSaved = true;

  try {
    fs.writeFileSync(filePath, changedXmlData);
  } catch (err) {
    console.log(err);
    isSaved = false;
  }

  return isSaved;
}
function writeJsonAsXml ( jsData , filePath , options ) { var xmlBuilder = new xml2js . Builder ( options ) ; var changedXmlData = xmlBuilder . buildObject ( jsData ) ; var isSaved = true ; try { fs . writeFileSync ( filePath , changedXmlData ) ; } catch ( err ) { console . log ( err ) ; isSaved = false ; } return isSaved ; }
Write JSON object as xml into the specified file.

@param {Object} jsData - JSON object to write
@param {String} filePath - path to the xml file where data should be saved
@param {Object} options - xml options
@return {boolean} true - if data saved to file; false - otherwise
Write JSON object as xml into the specified file .