/** * 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]); }
/** * <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); }
public boolean removeChild(String name, Namespace ns) { return element.removeChild(name, ns); }
public boolean removeChild(String name) { return element.removeChild(name); }
void remove(final String toLevelElementName) throws JDOMException { document.getRootElement().removeChild(toLevelElementName); }
@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); } } }
public Object remove(Object key) { currentElement().removeChild((String) key); types.remove(key); return null; }
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()); }
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; }
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; }
resolvedXml.removeChild("datasets", resolvedXml.getNamespace());
resolvedXml.removeChild("datasets", resolvedXml.getNamespace());
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());
st.close(); dataElements[i].removeChild("dataElementData", DataThingXMLFactory.namespace);
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());
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()); }
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()); }
event.removeChild("start-instance", event.getNamespace()); event.removeChild("end-instance", event.getNamespace());
event.removeChild("start-instance", event.getNamespace()); event.removeChild("end-instance", event.getNamespace());
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);