org.jdom2.Element.removeChild()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(3.8k)|赞(0)|评价(0)|浏览(131)

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

Element.removeChild介绍

[英]This removes the first child element (one level deep) with the given local name and belonging to no namespace. Returns true if a child was removed.
[中]这将删除具有给定本地名称且不属于任何命名空间的第一个子元素(一级深)。如果删除了子级,则返回true。

代码示例

代码示例来源:origin: org.jdom/jdom

/**
 * <p>
 * This removes the first child element (one level deep) with the
 * given local name and belonging to no namespace.
 * Returns true if a child was removed.
 * </p>
 *
 * @param cname the name of child elements to remove
 * @return whether deletion occurred
 */
public boolean removeChild(final String cname) {
  return removeChild(cname, Namespace.NO_NAMESPACE);
}

代码示例来源:origin: org.codehaus.plexus/plexus-component-metadata

/**
 * @see org.jdom2.Element#removeChild(java.lang.String,org.jdom2.Namespace)
 * @param name The name of the child.
 * @param ns {@link Namespace}
 * @return true/false.
 */
public boolean removeChild( String name, Namespace ns )
{
  return element.removeChild( name, ns );
}

代码示例来源:origin: org.codehaus.plexus/plexus-component-metadata

/**
 * @see org.jdom2.Element#removeChild(java.lang.String)
 * @param name The name of the child.
 * @return true/false.
 */
public boolean removeChild( String name )
{
  return element.removeChild( name );
}

代码示例来源:origin: com.xebialabs.cloud/overcast

/** remove elements that need to be unique per clone. */
  public static Document prepareForCloning(Document domainXml) {
    XPathFactory xpf = XPathFactory.instance();

    // remove uuid so it will be generated
    domainXml.getRootElement().removeChild("uuid");

    // remove mac address, so it will be generated
    XPathExpression<Element> macExpr = xpf.compile("/domain/devices/interface/mac", Filters.element());
    for (Element mac : macExpr.evaluate(domainXml)) {
      mac.getParentElement().removeChild("mac");
    }
    return domainXml;
  }
}

代码示例来源:origin: rometools/rome

@Override
protected void populateItem(final Item item, final Element eItem, final int index) {
  super.populateItem(item, eItem, index);
  final Description description = item.getDescription();
  if (description != null && description.getType() != null) {
    final Element eDescription = eItem.getChild("description", getFeedNamespace());
    eDescription.setAttribute(new Attribute("type", description.getType()));
  }
  eItem.removeChild("expirationDate", getFeedNamespace());
}

代码示例来源:origin: com.rometools/rome

@Override
protected void populateItem(final Item item, final Element eItem, final int index) {
  super.populateItem(item, eItem, index);
  final Description description = item.getDescription();
  if (description != null && description.getType() != null) {
    final Element eDescription = eItem.getChild("description", getFeedNamespace());
    eDescription.setAttribute(new Attribute("type", description.getType()));
  }
  eItem.removeChild("expirationDate", getFeedNamespace());
}

代码示例来源:origin: org.apache.marmotta/sesame-tools-rio-rss

protected void populateItem(Item item, Element eItem, int index) {
  super.populateItem(item,eItem, index);
  Description description = item.getDescription();
  if (description!=null && description.getType()!=null) {
    Element eDescription = eItem.getChild("description",getFeedNamespace());
    eDescription.setAttribute(new Attribute("type",description.getType()));
  }
  eItem.removeChild("expirationDate",getFeedNamespace());
}

代码示例来源:origin: apache/marmotta

protected void populateItem(Item item, Element eItem, int index) {
  super.populateItem(item,eItem, index);
  Description description = item.getDescription();
  if (description!=null && description.getType()!=null) {
    Element eDescription = eItem.getChild("description",getFeedNamespace());
    eDescription.setAttribute(new Attribute("type",description.getType()));
  }
  eItem.removeChild("expirationDate",getFeedNamespace());
}

相关文章

微信公众号

最新文章

更多