本文整理汇总了Java中mf.org.w3c.dom.Node.removeChild方法的典型用法代码示例。如果您正苦于以下问题:Java Node.removeChild方法的具体用法?Java Node.removeChild怎么用?Java Node.removeChild使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mf.org.w3c.dom.Node
的用法示例。
在下文中一共展示了Node.removeChild方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: replaceRenameElement
import mf.org.w3c.dom.Node; //导入方法依赖的package包/类
private ElementImpl replaceRenameElement(ElementImpl el, String namespaceURI, String name) {
// we need to create a new object
ElementNSImpl nel = (ElementNSImpl)createElementNS(namespaceURI, name);
// register event listeners on new node
copyEventListeners(el, nel);
// remove user data from old node
Hashtable data = removeUserDataTable(el);
// remove old node from parent if any
Node parent = el.getParentNode();
Node nextSib = el.getNextSibling();
if (parent != null) {
parent.removeChild(el);
}
// move children to new node
Node child = el.getFirstChild();
while (child != null) {
el.removeChild(child);
nel.appendChild(child);
child = el.getFirstChild();
}
// move specified attributes to new node
nel.moveSpecifiedAttributes(el);
// attach user data to new node
setUserDataTable(nel, data);
// and fire user data NODE_RENAMED event
callUserDataHandlers(el, nel,
UserDataHandler.NODE_RENAMED);
// insert new node where old one was
if (parent != null) {
parent.insertBefore(nel, nextSib);
}
return nel;
}
示例2: endCDATA
import mf.org.w3c.dom.Node; //导入方法依赖的package包/类
/**
* The end of a CDATA section.
* @param augs Additional information that may include infoset augmentations
*
* @throws XNIException Thrown by handler to signal an error.
*/
public void endCDATA (Augmentations augs) throws XNIException {
fInCDATASection = false;
if (!fDeferNodeExpansion) {
if (fFilterReject) {
return;
}
if (fCurrentCDATASection !=null) {
if (fDOMFilter !=null && !fInEntityRef &&
(fDOMFilter.getWhatToShow () & NodeFilter.SHOW_CDATA_SECTION)!= 0) {
short code = fDOMFilter.acceptNode (fCurrentCDATASection);
switch (code) {
case LSParserFilter.FILTER_INTERRUPT:{
throw Abort.INSTANCE;
}
case LSParserFilter.FILTER_REJECT:{
// fall through to SKIP since CDATA section has no children.
}
case LSParserFilter.FILTER_SKIP: {
Node parent = fCurrentNode.getParentNode ();
parent.removeChild (fCurrentCDATASection);
fCurrentNode = parent;
return;
}
default: {
// accept node
}
}
}
fCurrentNode = fCurrentNode.getParentNode ();
fCurrentCDATASection = null;
}
}
else {
if (fCurrentCDATASectionIndex !=-1) {
fCurrentNodeIndex =
fDeferredDocumentImpl.getParentNode (fCurrentNodeIndex, false);
fCurrentCDATASectionIndex = -1;
}
}
}
示例3: removeChild
import mf.org.w3c.dom.Node; //导入方法依赖的package包/类
Node removeChild(Node parent, Node child) {
fRemoveChild = child;
Node n = parent.removeChild(child);
fRemoveChild = null;
return n;
}