var xmlFile;
var obj_UserData;
function preload(){
xmlFile = new XML();
xmlFile = loadXML("XML/UserInfo.xml");
}
function setup(){
createCanvas(windowWidth,windowHeight);
obj_UserData = new obj_UserData();
obj_UserData.parseXML();
}
class UserData{
function parseXML(){
print(xmlFile.getChildren('User'));
}
}
The error I’m still getting is “TypeError: xmlFile.getChildren is not a function”
I forgot I needed to hand over the info to the constructor.
var xmlFile;
var obj_UserData;
function preload(){
xmlFile = loadXML("XML/Data.xml");
}
function setup(){
obj_UserData = new DataHolder(xmlFile);
obj_UserData.ReadXml();
}
class UserData{
constructor(_xml){
this.xml = _xml;
}
ReadXml(){
print(this.XML.getChildren('User'));
}
}