loadXML() results in error

Hello, I need to get a value from a web page and use this in my p5.js sketch. I do this by using the loadXML command, but it does not work. What I want to achieve is getting a string with the source code of the web page, so that I can get the value out of this string. I tried to do this with the following code:

function setup() {
  createCanvas(200, 200);
  var url = 'http://creators.ewi.utwente.nl/site/s1712187/SmartPad/';
  loadXML(url, callback, error);
}

function draw() {
  
}

function callback() {
  print("it is callback");
}

function error() {
  print("it is error");
}

"It is error" is the line that is printed when I run the sketch. Who knows what my mistake is?? Of course the code should be extended by creating a string and reading the data etc. but first the loadXML function should load the html source code properly.

(The only examples that I can find are based on JSON instead of XML.)

Tagged:

Answers

Sign In or Register to comment.