Im trying on various sources but i count see a single tutorial or piece of code. Im a beginner . thanks in advance
Asked
Active
Viewed 4,168 times
-4
-
A few threads about this: [How to parse xml in Angular 2](http://stackoverflow.com/questions/36368405/how-to-parse-xml-in-angular-2), [Read xml file data in angular2](http://stackoverflow.com/questions/42577492/read-xml-file-data-in-angular2), [parsing xml in angular2 to be rendered in the view](http://stackoverflow.com/questions/38765805/parsing-xml-in-angular2-to-be-rendered-in-the-view). Please search before asking – Nitzan Tomer Apr 27 '17 at 15:35
1 Answers
1
I also encountered troubles when I wanted to parse XML then there is a quick example to achieve it.
In one of my project, I used xml2js.
Install it and then you can, for example, use it like this:
parseXML : any = require('xml2js');
this.parseXML.parseString(xmlToParse, (err: any, res: any) => {
console.log(res); //res contains your parsed XML
}

Powkachu
- 2,170
- 2
- 26
- 36
-
i want to fetch a xml from url and parse it , it tried http get but i coudnt parse – Sri Vivek Apr 28 '17 at 05:35
-
You need a simple http get, look at the data you receive, maybe you need to just get an attribute – Powkachu Apr 28 '17 at 07:16