Java tutorial
//package com.java2s; //License from project: Open Source License import org.w3c.dom.Element; import org.w3c.dom.Node; import org.w3c.dom.NodeList; public class Main { public static void debugPrintChildren(Node node) { NodeList nl = node.getChildNodes(); System.out.println("-------------------"); for (int i = 0; i < nl.getLength(); i++) { System.out.println(nl.item(i).toString()); if (nl.item(i) instanceof Element) { System.out.println(((Element) nl.item(i)).getAttribute("className")); System.out.println(((Element) nl.item(i)).getTagName()); } System.out.println("---"); } } }