/** * Removes all of this node's children. */ public void removeAllChildren() { while (getFirstChild() != null) { getFirstChild().remove(); } }
/** * {@inheritDoc} */ @Override public DomNode firstChild() { final DomNode newNode = getEquivalentLogical(currentNode_.getFirstChild(), false); if (newNode != null) { currentNode_ = newNode; } return newNode; }
/** * {@inheritDoc} */ @Override public int getLength() { int length = 0; for (DomNode node = parent_.getFirstChild(); node != null; node = node.getNextSibling()) { length++; } return length; }
SiblingListIterator(final int index) { next_ = parent_.getFirstChild(); nextIndex_ = 0; for (int i = 0; i < index; i++) { next(); } }
private static DomNode getChild(final DomNode node, final boolean lookLeft) { if (node == null) { return null; } final DomNode child; if (lookLeft) { child = node.getFirstChild(); } else { child = node.getLastChild(); } return child; }
/** * {@inheritDoc} */ @Override public int getLength() { int length = 0; for (DomNode node = parent_.getFirstChild(); node != null; node = node.getNextSibling()) { length++; } return length; }
SiblingListIterator(final int index) { next_ = parent_.getFirstChild(); nextIndex_ = 0; for (int i = 0; i < index; i++) { next(); } }
/** * Removes all of this node's children. */ public void removeAllChildren() { if (getFirstChild() == null) { return; } for (final Iterator<DomNode> it = getChildren().iterator(); it.hasNext();) { it.next().removeAllChildren(); it.remove(); } }
private DomNode getFirstChildElement(final DomNode parent) { DomNode node = parent.getFirstChild(); while (node != null && !isAccepted(node)) { node = node.getNextSibling(); } return node; }
/** * Gets the JavaScript property "firstChild" for the node that * contains the current node. * @return the first child node or null if the current node has * no children. */ public Node jsxGet_firstChild() { return getJavaScriptNode(getDomNodeOrDie().getFirstChild()); }
/** * Recursively writes the XML data for the node tree starting at <code>node</code>. * * @param indent white space to indent child nodes * @param printWriter writer where child nodes are written */ protected void printChildrenAsXml(final String indent, final PrintWriter printWriter) { DomNode child = getFirstChild(); while (child != null) { child.printXml(indent + " ", printWriter); child = child.getNextSibling(); } }
/** * Gets the JavaScript property "firstChild" for the node that * contains the current node. * @return the first child node or null if the current node has * no children. */ public Node jsxGet_firstChild() { return getJavaScriptNode(getDomNodeOrDie().getFirstChild()); }
/** * Gets the JavaScript property "firstChild" for the node that * contains the current node. * @return the first child node or null if the current node has * no children. */ public Node jsxGet_firstChild() { return getJavaScriptNode(this.<DomNode>getDomNodeOrDie().getFirstChild()); }
protected void printText(final DomNode node) { for (DomNode child = node.getFirstChild(); child != null; child = child.getNextSibling()) { if (child instanceof DomText) { builder_.append(((DomText) child).getData()); } else { printText(child); } } }
/** * Returns the first child of this node. * @return the first child of this node */ @JsxGetter public XMLDOMNode getFirstChild() { final DomNode domNode = getDomNodeOrDie(); return getJavaScriptNode(domNode.getFirstChild()); }
/** * Gets the JavaScript property {@code firstChild} for the node that * contains the current node. * @return the first child node or null if the current node has * no children. */ @JsxGetter public Node getFirstChild() { return getJavaScriptNode(getDomNodeOrDie().getFirstChild()); }
/** * {@inheritDoc} */ @Override public HTMLCollection jsxFunction_getElementsByTagName(final String tagName) { final HTMLCollection collection = new HTMLCollection(this); collection.init(getDomNodeOrDie().getFirstChild(), "//*[local-name()='" + tagName + "']"); return collection; }
/** * {@inheritDoc} */ @Override public HTMLCollection jsxFunction_getElementsByTagName(final String tagName) { final HTMLCollection collection = new HTMLCollection(this); collection.init(getDomNodeOrDie().getFirstChild(), "//*[local-name()='" + tagName + "']"); return collection; }
private HtmlElement getFirstChildElement(final DomNode parent) { if (parent instanceof HtmlNoScript && getPage().getEnclosingWindow().getWebClient().isJavaScriptEnabled()) { return null; } DomNode node = parent.getFirstChild(); while (node != null && node instanceof HtmlElement == false) { node = node.getNextSibling(); } return (HtmlElement) node; }
private HtmlElement getFirstChildElement(final DomNode parent) { if (parent instanceof HtmlNoScript && getPage().getEnclosingWindow().getWebClient().isJavaScriptEnabled()) { return null; } DomNode node = parent.getFirstChild(); while (node != null && node instanceof HtmlElement == false) { node = node.getNextSibling(); } return (HtmlElement) node; }