xml - Java-Handling empty nodes in DOM -


i using java dom parse xml file, format elements , output csv further processing later. want skip on nodes empty or id attribute null , i'm not sure how go this.

below exerpt source code, if want full listing let me know!


... setup ...   list<employee> emplist = new arraylist<>();  nodelist = document.getdocumentelement().getchildnodes();   (int = 0; < nodelist.getlength(); i++) {      node = nodelist.item(i);       if (node instanceof element) {          employee emp = new employee();           emp.id = node.getattributes().getnameditem("id").getnodevalue();          nodelist childnodes = node.getchildnodes();           (int j = 0; j < childnodes.getlength(); j++) {     ... identify child tags , add list.  

thanks, shaw


Comments

Popular posts from this blog

javascript - oscilloscope of speaker input stops rendering after a few seconds -

javascript - gulp-nodemon - nodejs restart after file change - Error: listen EADDRINUSE events.js:85 -

Fatal Python error: Py_Initialize: unable to load the file system codec. ImportError: No module named 'encodings' -