Example usage for org.dom4j Branch nodeIterator

List of usage examples for org.dom4j Branch nodeIterator

Introduction

In this page you can find the example usage for org.dom4j Branch nodeIterator.

Prototype

Iterator<Node> nodeIterator();

Source Link

Document

Returns an iterator through the content nodes of this branch

Usage

From source file:org.dommons.dom.dom4j.XDom4jNode.java

License:Open Source License

/**
 * ??//from  ww  w.  j  ava 2s.c o  m
 * @param parent 
 * @param name ???
 * @return 
 */
private static Element element(Branch parent, String name) {
    for (Iterator<Node> it = parent.nodeIterator(); it.hasNext();) {
        Node node = it.next();
        if (node.getNodeType() == Node.ELEMENT_NODE && name.equals(node.getName()))
            return (Element) node;
    }
    return null;
}

From source file:org.dommons.dom.dom4j.XDom4jNode.java

License:Open Source License

public List<XElement> elements(String... names) {
    Branch ele = element(names, 0, -1);
    List<XElement> list = new ArrayList();
    if (ele != null) {
        for (Iterator<Node> it = ele.nodeIterator(); it.hasNext();) {
            Node node = it.next();
            if (node.getNodeType() == Node.ELEMENT_NODE && names[names.length - 1].equals(node.getName()))
                list.add(new XDom4jElement((Element) node));
        }// w  w w  .ja va 2  s . c  om
    }
    return list;
}