XML in P2b
in
Core Library Questions
•
1 year ago
Hello,
I had a nice 'largish' personal project working fine for a while, now I am trying to get it to work using Processing 2 beta. I have jumped through some hoops already, like the XMLElement -> XML change, or the new more strict validator.
I am however still having problems,
the lines in questions are just:
it there something that one is suppose to do very different with the new library?
Should I check if it has a string with that name before I try to read it? I didn't have to do it before, it would just return null if there was no string.
I had a nice 'largish' personal project working fine for a while, now I am trying to get it to work using Processing 2 beta. I have jumped through some hoops already, like the XMLElement -> XML change, or the new more strict validator.
I am however still having problems,
- Exception in thread "Animation Thread" java.lang.NullPointerException
at processing.core.XML.getString(XML.java:442)
at processing.core.XML.getString(XML.java:437)
at zmidi.ZMidi.openSceneList(ZMidi.java:398)
the lines in questions are just:
- xml = new XML(this,fn); // default xml
- // xml = new XMLElement(fn); //proxml
- int numScenes = xml.getChildCount();
- println(numScenes); // reports 35, an incorrect number of scenes, there are 17
- for (int i = 0; i < numScenes; i++) {
- scene = xml.getChild(i);
- String name = scene.getString("name"); // this is the reported line
- println (name); // never gets here
it there something that one is suppose to do very different with the new library?
Should I check if it has a string with that name before I try to read it? I didn't have to do it before, it would just return null if there was no string.
1