nashwaan / xml-js

Converter utility between XML text and Javascript object / JSON text.
MIT License
1.28k stars 182 forks source link

Angular 2+ #65

Open Mazowiecki opened 6 years ago

Mazowiecki commented 6 years ago

How can I use it with angular 2+???????

marcinwadon commented 6 years ago

Hey @Mazowiecki, could you describe more precisely your problem? This is an example from my application where I successfully used xml-js:

    return this.http.post<string>(url, xml, options).pipe(
      map(fromNullable),
      map(body => body
        .map(data => xml2js(data, { compact: true }))),
      map(parseSoapResponse),
    )

The most interesting part for you is xml2js(data, { compact: true }) (xml-js imported as import { xml2js } from 'xml-js') where as the first argument you should provide your xml data, and the second one - options