List of usage examples for org.dom4j Branch node
Node node(int index) throws IndexOutOfBoundsException;
Node
at the specified index position. 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 w w w. j a va2s . com } return null; }
From source file:org.hudsonci.xpath.impl.Dom2Dom.java
License:Open Source License
private Node getNodeForPath(Document doc, SimplePath path) { Node node = doc;//ww w.j ava 2s.co m for (SimplePath p = path; p != null; p = p.next) { if (!(node instanceof Branch)) throw new IllegalStateException("Node with children not a Branch"); Branch parent = (Branch) node; node = parent.node(p.childNum); } return node; }
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); org.w3c.dom.Node wchild = createChild(child, wparent); if (wchild != null) createChildren((Branch) child, wchild); }//from w w w . j av a2 s. c o m 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 {//from w w w .j av a 2s. c om cln = (org.dom4j.Node) node.clone(); } add(cln); } }