Answer the question
In order to leave comments, you need to log in
How to unload data from XML file in Angular2 and process it with x2js?
I have an XML file that I'm trying to dump data from - first just text and then 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); }}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question