XML parser not working
in
Programming Questions
•
1 year ago
Dear all interested readers,
I've been reading alot of forum posts about XML parsing with 2.0, but I don't seem to get why the next code is not working:
What am I doing wrong? I am using a right link, but I get a NPE at:
String url = kid.getString("artikel");
-
Hope that someone knows how to help.
Kind regards,
Joshua
I've been reading alot of forum posts about XML parsing with 2.0, but I don't seem to get why the next code is not working:
XML xml;
void setup() {
size(200, 200);
xml = new XML(this, "http://robotfunk.com/temp/getall.php?keyword[]=&keyword[]=crisis");
int numSites = xml.getChildCount();
for (int i = 0; i < numSites; i++) {
XML kid = xml.getChild(i);
String url = kid.getString("artikel");
String site = kid.getContent();
println(url + " : " + site);
}
}
What am I doing wrong? I am using a right link, but I get a NPE at:
String url = kid.getString("artikel");
-
Hope that someone knows how to help.
Kind regards,
Joshua
2