public final Object setUserData(String key, Object data, UserDataHandler handler) { if (key == null) { throw new NullPointerException("key == null"); } Map<String, UserData> map = document.getUserDataMap(this); UserData previous = data == null ? map.remove(key) : map.put(key, new UserData(data, handler)); return previous != null ? previous.value : null; }
/** * Recursively change the document of {@code node} without also changing its * parent node. Only adoptNode() should invoke this method, otherwise nodes * will be left in an inconsistent state. */ private void changeDocumentToThis(NodeImpl node) { Map<String, UserData> userData = node.document.getUserDataMapForRead(node); if (!userData.isEmpty()) { getUserDataMap(node).putAll(userData); } node.document = this; // change the document on all child nodes NodeList list = node.getChildNodes(); for (int i = 0; i < list.getLength(); i++) { changeDocumentToThis((NodeImpl) list.item(i)); } // change the document on all attribute nodes if (node.getNodeType() == Node.ELEMENT_NODE) { NamedNodeMap attributes = node.getAttributes(); for (int i = 0; i < attributes.getLength(); i++) { changeDocumentToThis((AttrImpl) attributes.item(i)); } } }
/** * Recursively change the document of {@code node} without also changing its * parent node. Only adoptNode() should invoke this method, otherwise nodes * will be left in an inconsistent state. */ private void changeDocumentToThis(NodeImpl node) { Map<String, UserData> userData = node.document.getUserDataMapForRead(node); if (!userData.isEmpty()) { getUserDataMap(node).putAll(userData); } node.document = this; // change the document on all child nodes NodeList list = node.getChildNodes(); for (int i = 0; i < list.getLength(); i++) { changeDocumentToThis((NodeImpl) list.item(i)); } // change the document on all attribute nodes if (node.getNodeType() == Node.ELEMENT_NODE) { NamedNodeMap attributes = node.getAttributes(); for (int i = 0; i < attributes.getLength(); i++) { changeDocumentToThis((AttrImpl) attributes.item(i)); } } }
public final Object setUserData(String key, Object data, UserDataHandler handler) { if (key == null) { throw new NullPointerException("key == null"); } Map<String, UserData> map = document.getUserDataMap(this); UserData previous = data == null ? map.remove(key) : map.put(key, new UserData(data, handler)); return previous != null ? previous.value : null; }
/** * Recursively change the document of {@code node} without also changing its * parent node. Only adoptNode() should invoke this method, otherwise nodes * will be left in an inconsistent state. */ private void changeDocumentToThis(NodeImpl node) { Map<String, UserData> userData = node.document.getUserDataMapForRead(node); if (!userData.isEmpty()) { getUserDataMap(node).putAll(userData); } node.document = this; // change the document on all child nodes NodeList list = node.getChildNodes(); for (int i = 0; i < list.getLength(); i++) { changeDocumentToThis((NodeImpl) list.item(i)); } // change the document on all attribute nodes if (node.getNodeType() == Node.ELEMENT_NODE) { NamedNodeMap attributes = node.getAttributes(); for (int i = 0; i < attributes.getLength(); i++) { changeDocumentToThis((AttrImpl) attributes.item(i)); } } }
public final Object setUserData(String key, Object data, UserDataHandler handler) { if (key == null) { throw new NullPointerException("key == null"); } Map<String, UserData> map = document.getUserDataMap(this); UserData previous = data == null ? map.remove(key) : map.put(key, new UserData(data, handler)); return previous != null ? previous.value : null; }
/** * Recursively change the document of {@code node} without also changing its * parent node. Only adoptNode() should invoke this method, otherwise nodes * will be left in an inconsistent state. */ private void changeDocumentToThis(NodeImpl node) { Map<String, UserData> userData = node.document.getUserDataMapForRead(node); if (!userData.isEmpty()) { getUserDataMap(node).putAll(userData); } node.document = this; // change the document on all child nodes NodeList list = node.getChildNodes(); for (int i = 0; i < list.getLength(); i++) { changeDocumentToThis((NodeImpl) list.item(i)); } // change the document on all attribute nodes if (node.getNodeType() == Node.ELEMENT_NODE) { NamedNodeMap attributes = node.getAttributes(); for (int i = 0; i < attributes.getLength(); i++) { changeDocumentToThis((AttrImpl) attributes.item(i)); } } }
public final Object setUserData(String key, Object data, UserDataHandler handler) { if (key == null) { throw new NullPointerException("key == null"); } Map<String, UserData> map = document.getUserDataMap(this); UserData previous = data == null ? map.remove(key) : map.put(key, new UserData(data, handler)); return previous != null ? previous.value : null; }
/** * Recursively change the document of {@code node} without also changing its * parent node. Only adoptNode() should invoke this method, otherwise nodes * will be left in an inconsistent state. */ private void changeDocumentToThis(NodeImpl node) { Map<String, UserData> userData = node.document.getUserDataMapForRead(node); if (!userData.isEmpty()) { getUserDataMap(node).putAll(userData); } node.document = this; // change the document on all child nodes NodeList list = node.getChildNodes(); for (int i = 0; i < list.getLength(); i++) { changeDocumentToThis((NodeImpl) list.item(i)); } // change the document on all attribute nodes if (node.getNodeType() == Node.ELEMENT_NODE) { NamedNodeMap attributes = node.getAttributes(); for (int i = 0; i < attributes.getLength(); i++) { changeDocumentToThis((AttrImpl) attributes.item(i)); } } }
public final Object setUserData(String key, Object data, UserDataHandler handler) { if (key == null) { throw new NullPointerException("key == null"); } Map<String, UserData> map = document.getUserDataMap(this); UserData previous = data == null ? map.remove(key) : map.put(key, new UserData(data, handler)); return previous != null ? previous.value : null; }
/** * Recursively change the document of {@code node} without also changing its * parent node. Only adoptNode() should invoke this method, otherwise nodes * will be left in an inconsistent state. */ private void changeDocumentToThis(NodeImpl node) { Map<String, UserData> userData = node.document.getUserDataMapForRead(node); if (!userData.isEmpty()) { getUserDataMap(node).putAll(userData); } node.document = this; // change the document on all child nodes NodeList list = node.getChildNodes(); for (int i = 0; i < list.getLength(); i++) { changeDocumentToThis((NodeImpl) list.item(i)); } // change the document on all attribute nodes if (node.getNodeType() == Node.ELEMENT_NODE) { NamedNodeMap attributes = node.getAttributes(); for (int i = 0; i < attributes.getLength(); i++) { changeDocumentToThis((AttrImpl) attributes.item(i)); } } }
public final Object setUserData(String key, Object data, UserDataHandler handler) { if (key == null) { throw new NullPointerException("key == null"); } Map<String, UserData> map = document.getUserDataMap(this); UserData previous = data == null ? map.remove(key) : map.put(key, new UserData(data, handler)); return previous != null ? previous.value : null; }
/** * Recursively change the document of {@code node} without also changing its * parent node. Only adoptNode() should invoke this method, otherwise nodes * will be left in an inconsistent state. */ private void changeDocumentToThis(NodeImpl node) { Map<String, UserData> userData = node.document.getUserDataMapForRead(node); if (!userData.isEmpty()) { getUserDataMap(node).putAll(userData); } node.document = this; // change the document on all child nodes NodeList list = node.getChildNodes(); for (int i = 0; i < list.getLength(); i++) { changeDocumentToThis((NodeImpl) list.item(i)); } // change the document on all attribute nodes if (node.getNodeType() == Node.ELEMENT_NODE) { NamedNodeMap attributes = node.getAttributes(); for (int i = 0; i < attributes.getLength(); i++) { changeDocumentToThis((AttrImpl) attributes.item(i)); } } }
public final Object setUserData(String key, Object data, UserDataHandler handler) { if (key == null) { throw new NullPointerException("key == null"); } Map<String, UserData> map = document.getUserDataMap(this); UserData previous = data == null ? map.remove(key) : map.put(key, new UserData(data, handler)); return previous != null ? previous.value : null; }