I am setting up a Xml Export functionality, whose function is to convert Json data from DB to Xml and save as .xml file in specific folder.
I tried this link
https://shekhargulati.com/2017/07/16/implementing-file-save-functionality-with-angular-4/
but don't save as .Xml
file.
I already converted the Json data to Xml data using this code
this.ordertemplateService.GetOrderTemplate().subscribe((res: any) => {
console.log(res.data);
var jxmlparser = require('js2xmlparser');
if (res != null) {
result = jxmlparser.parse('OrderTemplate',res.data);
console.log('back to xml -> %s', result);
}
and the Import too(XML to JSON).
let parseString = require('xml2js').parseString;
let xml = "<root>Hello xml2js!</root>"
parseString(xml, function (err, result) {
console.dir(result);
}
But don't know how to move forward. Please brainstorm me with your knowledge.