/** * Get the last child of <code>e</code> which is an element, or <code>null</code> if there is no such element. * * @param e * e * @return n */ public static Element getLastChildElement(Element e) { Node n = e.getLastChild(); while (n != null && n.getNodeType() != Node.ELEMENT_NODE) { n = n.getPreviousSibling(); } // Now n is either null or an Element return (Element) n; }
/** * Get the last child of <code>e</code> which is an element, or <code>null</code> if there is no such element. * * @param e * e * @return n */ public static Element getLastChildElement(Element e) { Node n = e.getLastChild(); while (n != null && n.getNodeType() != Node.ELEMENT_NODE) { n = n.getPreviousSibling(); } // Now n is either null or an Element return (Element) n; }
Element t = (Element) mtu.getLastChild(); t.setAttribute("accent", "unknown");
Element t = (Element) mtu.getLastChild(); t.setAttribute("accent", "unknown");
public Element getlastChild(Element e) { Node n = e.getLastChild(); while (n != null && n.getNodeType() != Node.ELEMENT_NODE) n = n.getPreviousSibling(); return n == null ? null : (Element) n; }
public static Element getLastChild(Element e) { if (e == null) return null; Node n = e.getLastChild(); while (n != null && n.getNodeType() != Node.ELEMENT_NODE) n = n.getPreviousSibling(); return (Element) n; }
public static Element getLastChild(Element e) { if (e == null) return null; Node n = e.getLastChild(); while (n != null && n.getNodeType() != Node.ELEMENT_NODE) n = n.getPreviousSibling(); return (Element) n; }
private void reapComments(org.w3c.dom.Element element, Element context) { Node node = element.getPreviousSibling(); while (node != null && node.getNodeType() != Node.ELEMENT_NODE) { if (node.getNodeType() == Node.COMMENT_NODE) context.getComments().add(0, node.getTextContent()); node = node.getPreviousSibling(); } node = element.getLastChild(); while (node != null && node.getNodeType() != Node.ELEMENT_NODE) { node = node.getPreviousSibling(); } while (node != null) { if (node.getNodeType() == Node.COMMENT_NODE) context.getComments().add(node.getTextContent()); node = node.getNextSibling(); } }
private void reapComments(org.w3c.dom.Element element, Element context) { Node node = element.getPreviousSibling(); while (node != null && node.getNodeType() != Node.ELEMENT_NODE) { if (node.getNodeType() == Node.COMMENT_NODE) context.getComments().add(0, node.getTextContent()); node = node.getPreviousSibling(); } node = element.getLastChild(); while (node != null && node.getNodeType() != Node.ELEMENT_NODE) { node = node.getPreviousSibling(); } while (node != null) { if (node.getNodeType() == Node.COMMENT_NODE) context.getComments().add(node.getTextContent()); node = node.getNextSibling(); } }
/** * Remove last child of an element, when present * * @param tag Parent */ public static void removeLastChild(Element tag) { final Node last = tag.getLastChild(); if(last != null) { tag.removeChild(last); } }
/** * Delete the children of the element * * @param container SVG-Element */ private void deleteChildren(Element container) { while(container.hasChildNodes()) { container.removeChild(container.getLastChild()); } }
/** * Delete the children of the element. * * @param container SVG-Element */ private void deleteChildren(Element container) { while(container.hasChildNodes()) { container.removeChild(container.getLastChild()); } }
/** * Delete the children of the element * * @param container SVG-Element */ private void deleteChildren(Element container) { while(container.hasChildNodes()) { container.removeChild(container.getLastChild()); } }
/** * Delete the children of the element * * @param container SVG-Element */ private void deleteChildren(Element container) { while(container.hasChildNodes()) { container.removeChild(container.getLastChild()); } }
/** * Delete the children of the element * * @param container SVG-Element */ private void deleteChildren(Element container) { while(container.hasChildNodes()) { container.removeChild(container.getLastChild()); } }
/** * Delete the children of the element * * @param container SVG-Element */ private void deleteChildren(Element container) { while(container.hasChildNodes()) { container.removeChild(container.getLastChild()); } }
@Override public void run() { // remove all existing children. while(parent.hasChildNodes()) { parent.removeChild(parent.getLastChild()); } super.run(); } }
/** * @see org.w3c.dom.Node#getLastChild() */ public Node getLastChild() { return getCurrentInternal().getLastChild(); }
@Override public void run() { // remove all existing children. while(parent.hasChildNodes()) { parent.removeChild(parent.getLastChild()); } super.run(); } }
public static DocumentFragment getContentAsFragment(Element element) { Node node = element.getFirstChild(); if (node == null) { return null; // no content } Range range = ((DocumentRange) element.getOwnerDocument()).createRange(); range.setStartBefore(node); range.setEndAfter(element.getLastChild()); return range.cloneContents(); }