1

Not able to figure out how to get data from an api having XML Content. I tried using axios,with JSON everything is clear. I want the data to be fetched from api on load and respective values to be filled in the form fields.

1 Answer 1

2
fetch(URL).then((results) => {
  // results returns XML. Cast this to a string, then create
  // a new DOM object out of it! like this
  results
    .text()
    .then(( str ) => {
      let responseDoc = new DOMParser().parseFromString(str, 'application/xml');
     }
  });

You can also use NPM module to parse XML.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.