I have an XML file, the data from which I am trying to upload - first simply with text and then with a JSON object using x2js
clickHandler() { let headers = new Headers(); headers.append('Content-Type', 'text/xml'); let text = ''; this.http.get('./xml/text') .map((res: Response) => res.text()) .subscribe(data => text = data); const x2js = new X2JS(); const jsonObj = x2js.xml2js(xml); let parseString = require('xml2js').parseString; let xml = text; //?? parseString(xml, function (err: any, result: any) { alert(result); } } Can you please tell how to accomplish this task?