Read xml file data in angular2

14,484

For parsing you can try with xml2js: https://github.com/Leonidas-from-XIV/node-xml2js.

Check this other answer: XML data parsing in angular 2

In a short:

import { parseString } from 'xml2js';
/* ... */
let xml = "<root>Hello xml2js!</root>"
parseString(xml, function (err, result) {
   console.dir(result);
});
Share:
14,484
Basil Joy
Author by

Basil Joy

Updated on June 04, 2022

Comments

  • Basil Joy
    Basil Joy almost 2 years

    In the Angular2 project, I have one xml file that contains all information about an employee. i need to read employee data from that xml file and display in my component template.

    How to read xml data using http service?