本文整理汇总了Java中org.w3c.dom.UserDataHandler.handle方法的典型用法代码示例。如果您正苦于以下问题:Java UserDataHandler.handle方法的具体用法?Java UserDataHandler.handle怎么用?Java UserDataHandler.handle使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.w3c.dom.UserDataHandler
的用法示例。
在下文中一共展示了UserDataHandler.handle方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: fireUserDataHandlers
import org.w3c.dom.UserDataHandler; //导入方法依赖的package包/类
/**
* Fire any UserDataHandlers on the given oldNode.
*/
protected void fireUserDataHandlers(short type,
Node oldNode,
Node newNode) {
AbstractNode an = (AbstractNode) oldNode;
if (an.userData != null) {
Iterator i = an.userData.entrySet().iterator();
while (i.hasNext()) {
Map.Entry e = (Map.Entry) i.next();
UserDataHandler h
= (UserDataHandler) an.userDataHandlers.get(e.getKey());
if (h != null) {
h.handle(type,
(String) e.getKey(),
e.getValue(),
oldNode,
newNode);
}
}
}
}
示例2: notifyUserDataHandlers
import org.w3c.dom.UserDataHandler; //导入方法依赖的package包/类
void notifyUserDataHandlers(short op, Node src, Node dst)
{
if (userDataHandlers != null)
{
for (Iterator i = userDataHandlers.entrySet().iterator(); i.hasNext(); )
{
Map.Entry entry = (Map.Entry) i.next();
String key = (String) entry.getKey();
UserDataHandler handler = (UserDataHandler) entry.getValue();
Object data = userData.get(key);
handler.handle(op, key, data, src, dst);
}
}
}
示例3: cloneNode
import org.w3c.dom.UserDataHandler; //导入方法依赖的package包/类
@Override
public Node cloneNode(boolean deep) {
try {
Node newNode = this.createSimilarNode();
NodeList children = this.getChildNodes();
int length = children.getLength();
for (int i = 0; i < length; i++) {
Node child = children.item(i);
Node newChild = deep ? child.cloneNode(deep) : child;
newNode.appendChild(newChild);
}
if (newNode instanceof Element) {
Element elem = (Element) newNode;
NamedNodeMap nnmap = this.getAttributes();
if (nnmap != null) {
int nnlength = nnmap.getLength();
for (int i = 0; i < nnlength; i++) {
Attr attr = (Attr) nnmap.item(i);
elem.setAttributeNode((Attr) attr.cloneNode(true));
}
}
}
synchronized (this) {
if (userDataHandlers != null && userData != null) {
for (Object element : userDataHandlers.entrySet()) {
Map.Entry entry = (Map.Entry) element;
UserDataHandler handler = (UserDataHandler) entry.getValue();
handler.handle(UserDataHandler.NODE_CLONED, (String) entry.getKey(),
userData.get(entry.getKey()), this, newNode);
}
}
}
return newNode;
} catch (Exception err) {
throw new IllegalStateException(err.getMessage());
}
}