-4

Im trying on various sources but i count see a single tutorial or piece of code. Im a beginner . thanks in advance

Sri Vivek
  • 525
  • 7
  • 9
  • 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 Answers1

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