Example usage for org.dom4j Branch nodeCount

List of usage examples for org.dom4j Branch nodeCount

Introduction

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

Prototype

int nodeCount();

Source Link

Document

Returns the number of Node instances that this branch contains.

Usage

From source file:com.xebia.mojo.dashboard.util.TidyXmlUtil.java

License:Apache License

/** {@inheritDoc} */
public Node getChild(Node parent, int index) {
    if (parent instanceof Element) {
        Branch parentElement = (Element) parent;

        if (parentElement.nodeCount() > index) {
            return parentElement.node(index);
        }//from www . j av a  2  s . c o m
    }

    return null;
}

From source file:org.hudsonci.xpath.impl.Dom2Dom.java

License:Open Source License

private void createChildren(Branch dparent, org.w3c.dom.Node wparent) {
    Branch b = (Branch) dparent;
    for (int i = 0, n = b.nodeCount(); i < n; i++) {
        Node child = b.node(i);/*from  w w  w.  j a  v a 2s  . c  o  m*/
        org.w3c.dom.Node wchild = createChild(child, wparent);
        if (wchild != null)
            createChildren((Branch) child, wchild);
    }
    endText(wparent);
}

From source file:org.orbeon.oxf.xml.dom4j.NonLazyUserDataElement.java

License:Open Source License

public void appendContent(final org.dom4j.Branch branch) {
    final int size = branch.nodeCount();
    for (int i = 0; i < size; i++) {
        final org.dom4j.Node node = branch.node(i);
        final org.dom4j.Node cln;
        if (node.getNodeType() == org.dom4j.Node.ELEMENT_NODE) {
            cln = ((NonLazyUserDataElement) node).cloneInternal();
        } else {/* w  w  w . j av  a2 s. co  m*/
            cln = (org.dom4j.Node) node.clone();
        }
        add(cln);
    }
}