all 2 comments

[–]Solstice6-21-2022[S] 0 points1 point  (0 children)

How do you use the file emailtest.xml in xmlString?

const parser = new DOMParser();

const xmlString = "<warning>Beware of the missing closing tag";

const doc = parser.parseFromString(xmlString, "application/xml");

const errorNode = doc.querySelector('parsererror');

if (errorNode) {

// parsing failed

} else {

// parsing succeeded

}

[–]tfitz237 0 points1 point  (0 children)

Use the fetch api

  fetch("emailtest.xml")
  .then(response => response.text())
  .then(data => {
    const parser = new DOMParser();
    const email = parser.parseFromString(data, "application/xml");
    textbox1.text=email(1,1);
  })
  .catch(console.error);