I am using java DOM to parse an xml file, format the elements and output as a csv for further processing later. However I want to skip over any nodes that are empty or where the id attribute is null and I'm not sure how to go about this.
below is an exerpt from my source code, if you want the full listing just let me know!
... setup ...
List<Employee> empList = new ArrayList<>();
nodeList = document.getDocumentElement().getChildNodes();
for (int i = 0; i < 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();
for (int j = 0; j < childNodes.getLength(); j++) {
... identify all child tags and add to list.
Thanks, Shaw