Here you can find the source of printNodes(Node node, int level)
Parameter | Description |
---|---|
node | current node in DOM |
level | depth of node |
public static void printNodes(Node node, int level)
//package com.java2s; //License from project: Open Source License import org.w3c.dom.Node; public class Main { /**/*from w w w .j a va 2 s . c o m*/ * Method to print nodes of the DOM * @param node current node in DOM * @param level depth of node */ public static void printNodes(Node node, int level) { level++; System.out.println(node); for (Node child = node.getFirstChild(); child != null; child = child.getNextSibling()) { printNodes(child, level); } return; } }