q5play
    Preparing search index...

    Function loadXML

    • 🛠 Loads an xml file from the specified url.

      Using await to get the loaded XML Element is recommended.

      Parameters

      • url: string

        xml file

      Returns object & PromiseLike<Element>

      an object containing the loaded XML Element in a property called obj.DOM or use await to get the XML Element directly

      await Canvas(200);
      background(0.8);
      textSize(32);

      let xml = await load('/assets/animals.xml');
      let mammals = xml.querySelectorAll('mammal');
      let y = -90;
      for (let mammal of mammals) {
      text(mammal.textContent, -90, (y += 32));
      }