dump XML Node - Android XML

Android examples for XML:XML Node

Description

dump XML Node

Demo Code

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

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 Tutorials