org.w3c.dom.Element.getLastChild()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(5.5k)|赞(0)|评价(0)|浏览(142)

本文整理了Java中org.w3c.dom.Element.getLastChild()方法的一些代码示例,展示了Element.getLastChild()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Element.getLastChild()方法的具体详情如下:
包路径:org.w3c.dom.Element
类名称:Element
方法名:getLastChild

Element.getLastChild介绍

暂无

代码示例

代码示例来源:origin: marytts/marytts

/**
 * 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;
}

代码示例来源:origin: marytts/marytts

/**
 * 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;
}

代码示例来源:origin: marytts/marytts

Element t = (Element) mtu.getLastChild();
t.setAttribute("accent", "unknown");

代码示例来源:origin: marytts/marytts

Element t = (Element) mtu.getLastChild();
t.setAttribute("accent", "unknown");

代码示例来源:origin: jamesagnew/hapi-fhir

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;
}

代码示例来源:origin: jamesagnew/hapi-fhir

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;
}

代码示例来源:origin: jamesagnew/hapi-fhir

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;
}

代码示例来源:origin: jamesagnew/hapi-fhir

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();
  }
}

代码示例来源:origin: jamesagnew/hapi-fhir

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();
  }
}

代码示例来源:origin: elki-project/elki

/**
 * 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);
 }
}

代码示例来源:origin: elki-project/elki

/**
 * Delete the children of the element
 *
 * @param container SVG-Element
 */
private void deleteChildren(Element container) {
 while(container.hasChildNodes()) {
  container.removeChild(container.getLastChild());
 }
}

代码示例来源:origin: elki-project/elki

/**
 * Delete the children of the element.
 *
 * @param container SVG-Element
 */
private void deleteChildren(Element container) {
 while(container.hasChildNodes()) {
  container.removeChild(container.getLastChild());
 }
}

代码示例来源:origin: elki-project/elki

/**
 * Delete the children of the element
 *
 * @param container SVG-Element
 */
private void deleteChildren(Element container) {
 while(container.hasChildNodes()) {
  container.removeChild(container.getLastChild());
 }
}

代码示例来源:origin: de.lmu.ifi.dbs.elki/elki-batik-visualization

/**
 * Delete the children of the element
 *
 * @param container SVG-Element
 */
private void deleteChildren(Element container) {
 while(container.hasChildNodes()) {
  container.removeChild(container.getLastChild());
 }
}

代码示例来源:origin: elki-project/elki

/**
 * Delete the children of the element
 *
 * @param container SVG-Element
 */
private void deleteChildren(Element container) {
 while(container.hasChildNodes()) {
  container.removeChild(container.getLastChild());
 }
}

代码示例来源:origin: elki-project/elki

/**
 * Delete the children of the element
 *
 * @param container SVG-Element
 */
private void deleteChildren(Element container) {
 while(container.hasChildNodes()) {
  container.removeChild(container.getLastChild());
 }
}

代码示例来源:origin: elki-project/elki

@Override
 public void run() {
  // remove all existing children.
  while(parent.hasChildNodes()) {
   parent.removeChild(parent.getLastChild());
  }
  super.run();
 }
}

代码示例来源:origin: org.opensingular/singular-commons

/**
 * @see org.w3c.dom.Node#getLastChild()
 */
public Node getLastChild() {
  return getCurrentInternal().getLastChild();
}

代码示例来源:origin: de.lmu.ifi.dbs.elki/elki-batik-visualization

@Override
 public void run() {
  // remove all existing children.
  while(parent.hasChildNodes()) {
   parent.removeChild(parent.getLastChild());
  }
  super.run();
 }
}

代码示例来源:origin: org.nuxeo.common/nuxeo-common

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();
}

相关文章

微信公众号

最新文章

更多