/** * Sets the wrapped stanza by this Route packet. ClientRoute packets may have a single child * element. This is a convenience method to avoid manipulating this underlying packet's * Element instance directly. * * @param childElement the child element. */ public void setChildElement(Element childElement) { for (Iterator i=element.elementIterator(); i.hasNext(); ) { element.remove((Element)i.next()); } element.add(childElement); }
/** * <p>Deletes the specified property.</p> * <p>You MAY NOT use the atttribute * markup (using a ':' in the last element name) with this call. * deleteProperty() removes both the containing text, and the element itself along with * any attributes associated with that element.</p> * * @param name the property to delete. */ public static void deleteProperty(Element element, String name) { // Remove property from cache. String[] propName = parsePropertyName(name); // Search for this property by traversing down the XML heirarchy. for (int i = 0; i < propName.length - 1; i++) { element = element.element(propName[i]); // Can't find the property so return. if (element == null) { return; } } // Found the correct element to remove, so remove it... element.remove(element.element(propName[propName.length - 1])); }
/** * Deletes the specified property. * * @param name the property to delete. */ public synchronized void deleteProperty(String name) { // Remove property from cache. propertyCache.remove(name); String[] propName = parsePropertyName(name); // Search for this property by traversing down the XML hierarchy. Element element = document.getRootElement(); for (int i = 0; i < propName.length - 1; i++) { element = element.element(propName[i]); // Can't find the property so return. if (element == null) { return; } } // Found the correct element to remove, so remove it... element.remove(element.element(propName[propName.length - 1])); if (element.elements().size() == 0) { element.getParent().remove(element); } // .. then write to disk. saveProperties(); JiveGlobals.setPropertyEncrypted(name, false); // Generate event. Map<String, Object> params = Collections.emptyMap(); PropertyEventDispatcher.dispatchEvent(name, PropertyEventDispatcher.EventType.xml_property_deleted, params); }
Element currentElement = vcard.element("PHOTO"); if (currentElement != null) { vcard.remove(currentElement);
String html = "<p></p><div></div><p>Hello<br/>world</p><p></p>"; Document doc = Jsoup.parse(html); for (Element element : doc.select("*")) { if (!element.hasText() && element.isBlock()) { element.remove(); } } System.out.println(doc.body().html())
element.remove(attr);
Element currentElement = vcard.element("PHOTO"); if (currentElement != null) { vcard.remove(currentElement);
@Override public void setPresence(Presence newPresence) { // Try to remove the element whose namespace is "http://jabber.org/protocol/muc" since we // don't need to include that element in future presence broadcasts Element element = newPresence.getElement().element(QName.get("x", "http://jabber.org/protocol/muc")); if (element != null) { newPresence.getElement().remove(element); } this.presence = newPresence; this.presence.setFrom(getRoleAddress()); updatePresence(); }
listElement.remove( remove );
private void updatePresence() { if (extendedInformation != null && presence != null) { // Remove any previous extendedInformation, then re-add it. Element mucUser = presence.getElement().element(QName.get("x", "http://jabber.org/protocol/muc#user")); if (mucUser != null) { // Remove any previous extendedInformation, then re-add it. presence.getElement().remove(mucUser); } Element exi = extendedInformation.createCopy(); presence.getElement().add(exi); } }
listElement.remove( remove );
Node node = (Node) it.next(); if (node instanceof CDATA) { element.remove(node); break;
Element parent = n.getParent(); if(parent!=null) parent.remove(n);
event.remove(items);
childElementCopy.remove(candidateElement); Element candidate = childElementCopy.addElement("candidate "); ProxyCandidate proxyCandidate = mediaProxy.addRelayAgent(sid, iq.getFrom().toString()); childElementCopy.remove(candidateElement); } else { candidateElement = childElementCopy.element("publicip"); if (candidateElement != null) { childElementCopy.remove(candidateElement); Element publicIp = childElementCopy.addElement("publicip"); try { childElementCopy.remove(candidateElement); reply.setError(PacketError.Condition.forbidden);
notification.getElement().remove(headers);
dataStored.setParent(null); child.remove(dataElement); child.setParent(null); replyPacket.setChildElement(child);