Java XML Node Parse parseList(Node node)

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

Description

parse List

License

Open Source License

Declaration

public static List<Node> parseList(Node node) 

Method Source Code

//package com.java2s;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;

import org.w3c.dom.Node;

public class Main {
    public static List<Node> parseList(Node node) {
        Objects.requireNonNull(node);

        if (!node.getNodeName().equalsIgnoreCase("list")) {
            throw new IllegalArgumentException("Node is not list: " + node);
        }/*from www.  j a  v a  2s .  c o m*/

        int n = node.getChildNodes().getLength();
        List<Node> nodes = new ArrayList<>(n);
        for (int i = 0; i < n; i++) {
            nodes.add(node.getChildNodes().item(i));
        }
        return nodes;
    }
}

Related

  1. parseArray(final Node array)
  2. parseDictionary(final Node dictionary)
  3. parseInt(Node node)
  4. parseIntervals(Node intervals)
  5. parseModule(Node module, PrintWriter out)
  6. parseOptionNode(Node node)
  7. parseOptionString(Node node)
  8. parsePairFirst(Node node)