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

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

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

代码示例

代码示例来源:origin: banq/jdonframework

/**
 * Deletes the specified property.
 * 
 * @param name
 *            the property to delete.
 */
public void deleteProperty(String name) {
  String[] propName = parsePropertyName(name);
  // Search for this property by traversing down the XML heirarchy.
  Element element = doc.getRootElement();
  for (int i = 0; i < propName.length - 1; i++) {
    element = element.getChild(propName[i]);
    // Can't find the property so return.
    if (element == null) {
      return;
    }
  }
  // Found the correct element to remove, so remove it...
  element.removeChild(propName[propName.length - 1]);
}

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

/**
 * <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 name the name of child elements to remove
 * @return whether deletion occurred
 */
public boolean removeChild(final String name) {
  return removeChild(name, Namespace.NO_NAMESPACE);
}

代码示例来源:origin: org.codehaus.xfire/xfire-core

public boolean removeChild(String name, Namespace ns)
{
  return element.removeChild(name, ns);
}

代码示例来源:origin: org.codehaus.xfire/xfire-core

public boolean removeChild(String name)
{
  return element.removeChild(name);
}

代码示例来源:origin: de.smartics.ci/smartics-ci-commons-hudson-config

void remove(final String toLevelElementName) throws JDOMException
{
 document.getRootElement().removeChild(toLevelElementName);
}

代码示例来源:origin: kaazing/gateway

@Override
public void visit(Element element) throws Exception {
  Element typeElement = element.getChild(REALM, namespace);
  if (typeElement != null) {
    if (element.getChildren(CONSTRAINT, namespace).size() == 0 && element.getChildren(AUTH_CONSTRAINT, namespace).size() == 0) {
      element.removeChild(REALM, namespace);
    }
  }   
}

代码示例来源:origin: org.sakaiproject.metaobj/sakai-metaobj-api

public Object remove(Object key) {
 currentElement().removeChild((String) key);
 types.remove(key);
 return null;
}

代码示例来源:origin: org.sakaiproject.metaobj/sakai-metaobj-tool-lib

protected void replaceNodes(Element root, ElementBean bean, EditedArtifactStorage sessionBean) {
 Element structuredData = root.getChild("formData").getChild("artifact").getChild("structuredData");
 structuredData.removeContent();
 structuredData.addContent((Element)bean.getBaseElement().clone());
 Element schema = root.getChild("formData").getChild("artifact").getChild("schema");
 Element schemaRoot = schema.getChild("element");
 StringTokenizer st = new StringTokenizer(sessionBean.getCurrentPath(), "/");
 Element newRoot = schemaRoot;
 while (st.hasMoreTokens()) {
   String schemaName = st.nextToken();
   List children = newRoot.getChild("children").getChildren("element");
   for (Iterator i=children.iterator();i.hasNext();) {
    Element schemaElement = (Element) i.next();
    if (schemaName.equals(schemaElement.getAttributeValue("name"))) {
      newRoot = schemaElement;
      break;
    }
   }
 }
 schema.removeChild("element");
 schema.addContent(newRoot.detach());
}

代码示例来源:origin: org.cytoscape/plugin-impl

private Element updatePluginElement(PluginInfo obj, Element Plugin) {
  if (!obj.getName().equals(obj.getPluginClassName())) {
    Plugin.getChild(nameTag).setText(obj.getName());
  }
  Plugin = updateBasicElement(obj, Plugin);
  Plugin.getChild(installLocTag).setText(obj.getInstallLocation());
  
  if (obj.getPluginClassName() != null) {
    Plugin.getChild(classTag).setText(obj.getPluginClassName());
  }
  Plugin.removeChild(authorListTag);
  Element Authors = new Element(authorListTag);
  for(AuthorInfo ai: obj.getAuthors()) {
    Element Author = new Element(authorTag);
    Author.addContent( new Element(nameTag).setText(ai.getAuthor()) );
    Author.addContent( new Element(instTag).setText(ai.getInstitution()) );
    Authors.addContent(Author);
  }
  Plugin.addContent(Authors);
  return Plugin;
}

代码示例来源:origin: cytoscape/application

private Element updatePluginElement(PluginInfo obj, Element Plugin) {
  if (!obj.getName().equals(obj.getPluginClassName())) {
    Plugin.getChild(nameTag).setText(obj.getName());
  }
  Plugin = updateBasicElement(obj, Plugin);
  Plugin.getChild(installLocTag).setText(obj.getInstallLocation());
  
  if (obj.getPluginClassName() != null) {
    Plugin.getChild(classTag).setText(obj.getPluginClassName());
  }
  Plugin.removeChild(authorListTag);
  Element Authors = new Element(authorListTag);
  for(AuthorInfo ai: obj.getAuthors()) {
    Element Author = new Element(authorTag);
    Author.addContent( new Element(nameTag).setText(ai.getAuthor()) );
    Author.addContent( new Element(instTag).setText(ai.getInstitution()) );
    Authors.addContent(Author);
  }
  Plugin.addContent(Authors);
  return Plugin;
}

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

resolvedXml.removeChild("datasets", resolvedXml.getNamespace());

代码示例来源:origin: org.apache.oozie/oozie-core

resolvedXml.removeChild("datasets", resolvedXml.getNamespace());

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

resolvedTmp.append(CoordELFunctions.INSTANCE_SEPARATOR)
        .append(dEvent.getChild("uris", dEvent.getNamespace()).getTextTrim());
    dEvent.removeChild("uris", dEvent.getNamespace());
  dEvent.getContent().add(1, uriInstance);
dEvent.removeChild(CoordCommandUtils.UNRESOLVED_INSTANCES_TAG, dEvent.getNamespace());

代码示例来源:origin: uk.org.mygrid.taverna.baclava/baclava-store-implementation

st.close();
dataElements[i].removeChild("dataElementData", DataThingXMLFactory.namespace);

代码示例来源:origin: org.apache.oozie/oozie-core

resolvedTmp.append(CoordELFunctions.INSTANCE_SEPARATOR)
        .append(dEvent.getChild("uris", dEvent.getNamespace()).getTextTrim());
    dEvent.removeChild("uris", dEvent.getNamespace());
  dEvent.getContent().add(1, uriInstance);
dEvent.removeChild(CoordCommandUtils.UNRESOLVED_INSTANCES_TAG, dEvent.getNamespace());

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

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: com.sun.syndication/com.springsource.com.sun.syndication

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/oozie

event.removeChild("start-instance", event.getNamespace());
event.removeChild("end-instance", event.getNamespace());

代码示例来源:origin: org.apache.oozie/oozie-core

event.removeChild("start-instance", event.getNamespace());
event.removeChild("end-instance", event.getNamespace());

代码示例来源:origin: jericks/geoserver-shell

String url = geoserver.getUrl() + "/rest/workspaces/" + URLUtil.encode(workspace) + "/wmsstores/" + URLUtil.encode(store) + ".xml";
Element element = JDOMBuilder.buildElement(HTTPUtils.get(url, geoserver.getUser(), geoserver.getPassword()));
element.removeChild("wmsLayers");
if (enabled != null) {
  JDOMUtil.getOrAdd(element, "enabled").setText(enabled);

相关文章

微信公众号

最新文章

更多