Java XML NodeList printNodeTypes(NodeList rows)

Here you can find the source of printNodeTypes(NodeList rows)

Description

For testing purpose, it print out Node list

License

Open Source License

Parameter

Parameter Description
rows a Nodelist

Declaration

public static void printNodeTypes(NodeList rows) 

Method Source Code

//package com.java2s;
/********************************************************************
 * Copyright (c) 1999 The Bean Factory, LLC.
 * All Rights Reserved./*from   w w w.ja v a  2s . c om*/
 *
 * The Bean Factory, LLC. makes no representations or
 * warranties about the suitability of the software, either express
 * or implied, including but not limited to the implied warranties of
 * merchantableness, fitness for a particular purpose, or
 * non-infringement. The Bean Factory, LLC. shall not be
 * liable for any damages suffered by licensee as a result of using,
 * modifying or distributing this software or its derivatives.
 *
 *******************************************************************/

import org.w3c.dom.*;

public class Main {
    /**
     For testing purpose, it print out Node list
        
     @param     rows    a Nodelist
     */
    public static void printNodeTypes(NodeList rows) {
        System.out.println("\tenumerating NodeList (of Elements):");
        System.out.println("\tClass\tNT\tNV");
        //iterate a given Node list
        for (int ri = 0; ri < rows.getLength(); ri++) {
            Node n = (Node) rows.item(ri);
            if (n instanceof Element) {
                System.out.print("\tElement");
            } else
                System.out.print("\tNode");

            //print out Node type and Node value
            System.out.println("\t" + n.getNodeType() + "\t" + n.getNodeValue());
        }
        System.out.println();
    }
}

Related

  1. parseSwitchers(NodeList switcherNodes)
  2. parseWidget(NodeList widgetList)
  3. prettyPrintLoop(NodeList nodes, StringBuilder string, String indentation)
  4. printNode(NodeList nodeList, int level)
  5. printNodeList(NodeList nodes)
  6. removeBlankTextNode(NodeList nodes)
  7. removeNodeListContent(NodeList nodeList)
  8. replace(Node src, NodeList nodes)
  9. replaceElement(Element oldElement, NodeList newNodes)