Java XML Node Tree dump(Node node)

Here you can find the source of dump(Node node)

Description

dump

License

Open Source License

Declaration

public static void dump(Node node) 

Method Source Code

//package com.java2s;
/*/*w w w. j  ava  2  s  . com*/
 * XmlUtil.java
 *
 * (c) 2009  The Echo Nest
 * See "license.txt" for terms
 *
 *
 */

import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node;

public class Main {
    public static void dump(Node node) {
        System.out.println("Node: " + node.getNodeName());
        NamedNodeMap nnm = node.getAttributes();
        if (nnm != null) {
            for (int i = 0; i < nnm.getLength(); i++) {
                Node n = nnm.item(i);
                System.out.println("   " + n.getNodeName() + ":" + n.getNodeValue());
            }
        }
    }
}

Related

  1. dump(final Node node)
  2. dumpTree(Node node)
  3. moveSubTree(Node from, Node to, Node context)