本文整理了Java中org.dom4j.Element.remove()
方法的一些代码示例,展示了Element.remove()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Element.remove()
方法的具体详情如下:
包路径:org.dom4j.Element
类名称:Element
方法名:remove
[英]Removes the given Attribute
from this element.
[中]从此元素中删除给定的Attribute
。
代码示例来源:origin: igniterealtime/Openfire
/**
* 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);
}
代码示例来源:origin: igniterealtime/Openfire
/**
* <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]));
}
代码示例来源:origin: igniterealtime/Openfire
/**
* 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);
}
代码示例来源:origin: igniterealtime/Openfire
Element currentElement = vcard.element("PHOTO");
if (currentElement != null) {
vcard.remove(currentElement);
代码示例来源:origin: stackoverflow.com
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())
代码示例来源:origin: igniterealtime/Openfire
element.remove(attr);
代码示例来源:origin: igniterealtime/Openfire
Element currentElement = vcard.element("PHOTO");
if (currentElement != null) {
vcard.remove(currentElement);
代码示例来源:origin: stackoverflow.com
e.remove();
代码示例来源:origin: igniterealtime/Openfire
@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();
}
代码示例来源:origin: igniterealtime/Openfire
listElement.remove( remove );
代码示例来源:origin: igniterealtime/Openfire
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);
}
}
代码示例来源:origin: igniterealtime/Openfire
listElement.remove( remove );
代码示例来源:origin: igniterealtime/Openfire
element.remove(iter.next());
Node node = it.next();
if (node instanceof CDATA) {
childElement.remove(node);
break;
代码示例来源:origin: igniterealtime/Openfire
Node node = (Node) it.next();
if (node instanceof CDATA) {
element.remove(node);
break;
代码示例来源:origin: jenkinsci/jenkins
Element parent = n.getParent();
if(parent!=null)
parent.remove(n);
代码示例来源:origin: igniterealtime/Openfire
event.remove(items);
代码示例来源:origin: igniterealtime/Openfire
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);
代码示例来源:origin: igniterealtime/Openfire
event.remove(items);
event.remove(items);
代码示例来源:origin: igniterealtime/Openfire
notification.getElement().remove(headers);
代码示例来源:origin: igniterealtime/Openfire
dataStored.setParent(null);
child.remove(dataElement);
child.setParent(null);
replyPacket.setChildElement(child);
内容来源于网络,如有侵权,请联系作者删除!