/** * Cloning a NamedNodeMap is a DEEP OPERATION; it always clones * all the nodes contained in the map. */ public NamedNodeMapImpl cloneMap(NodeImpl ownerNode) { NamedNodeMapImpl newmap = new NamedNodeMapImpl(ownerNode); newmap.cloneContent(this); return newmap; }
/** Clones the node. */ public Node cloneNode(boolean deep) { DocumentTypeImpl newnode = (DocumentTypeImpl)super.cloneNode(deep); // NamedNodeMaps must be cloned explicitly, to avoid sharing them. newnode.entities = entities.cloneMap(newnode); newnode.notations = notations.cloneMap(newnode); newnode.elements = elements.cloneMap(newnode); return newnode; } // cloneNode(boolean):Node
protected int getNamedItemIndex(String namespaceURI, String localName) { return findNamePoint(namespaceURI, localName); }
/***/ public Node removeNamedItem(String name) throws DOMException { if (isReadOnly()) { String msg = DOMMessageFormatter.formatMessage(DOMMessageFormatter.DOM_DOMAIN, "NO_MODIFICATION_ALLOWED_ERR", null); throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR, msg); } int i = findNamePoint(name,0); if (i < 0) { String msg = DOMMessageFormatter.formatMessage(DOMMessageFormatter.DOM_DOMAIN, "NOT_FOUND_ERR", null); throw new DOMException(DOMException.NOT_FOUND_ERR, msg); } NodeImpl n = (NodeImpl)nodes.get(i); nodes.remove(i); return n; } // removeNamedItem(String):Node
if (entities.getLength() != argEntities.getLength()) return false; for (int index = 0; entities.item(index) != null; index++) { Node entNode1 = entities.item(index); Node entNode2 = argEntities.getNamedItem(entNode1.getNodeName()); if (notations.getLength() != argNotations.getLength()) return false; for (int index = 0; notations.item(index) != null; index++) { Node noteNode1 = notations.item(index); Node noteNode2 = argNotations.getNamedItem(noteNode1.getNodeName());
(DeferredDocumentImpl)this.ownerDocument; entities = new NamedNodeMapImpl(this); notations = new NamedNodeMapImpl(this); elements = new NamedNodeMapImpl(this); entities.setNamedItem(node); break; notations.setNamedItem(node); break; elements.setNamedItem(node); break;
/** * Internal subroutine returns this NodeNameMap's (shallow) readOnly value. * */ boolean getReadOnly() { return isReadOnly(); } // getReadOnly()
/** Factory constructor. */ public ElementDefinitionImpl(CoreDocumentImpl ownerDocument, String name) { super(ownerDocument); this.name = name; attributes = new NamedNodeMapImpl(ownerDocument); }
(d = defaults.getNamedItem(name)) != null && findNamePoint(name, index+1) < 0) { NodeImpl clone = (NodeImpl)d.cloneNode(true);
/** * NON-DOM * set the ownerDocument of this node, and the attributes it contains */ protected void setOwnerDocument(CoreDocumentImpl doc) { if (nodes != null) { final int size = nodes.size(); for (int i = 0; i < size; ++i) { ((NodeImpl)item(i)).setOwnerDocument(doc); } } }
if (((NamedNodeMapImpl)container.getNotations()).precedes(otherAncestor,thisAncestor)) return (DOCUMENT_POSITION_PRECEDING | DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC); DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC); else if (((NamedNodeMapImpl)container.getEntities()).precedes(otherAncestor,thisAncestor)) return (DOCUMENT_POSITION_PRECEDING | DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC); otherNode = ((AttrImpl)otherAncestor).getOwnerElement(); if (otherNode == thisNode) { if (((NamedNodeMapImpl)thisNode.getAttributes()).precedes(other,this)) return (DOCUMENT_POSITION_PRECEDING | DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC);
if (isReadOnly()) { String msg = DOMMessageFormatter.formatMessage(DOMMessageFormatter.DOM_DOMAIN, "NO_MODIFICATION_ALLOWED_ERR", null); throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR, msg); int i = findNamePoint(arg.getNamespaceURI(), arg.getLocalName()); NodeImpl previous = null; if (i >= 0) { i = findNamePoint(arg.getNodeName(),0); if (i >= 0) { previous = (NodeImpl) nodes.get(i);
/** Synchronizes the default attribute values. */ protected void synchronizeChildren() { // we don't want to generate any event for this so turn them off boolean orig = ownerDocument.getMutationEvents(); ownerDocument.setMutationEvents(false); // attributes are now synced needsSyncChildren(false); // create attributes node map DeferredDocumentImpl ownerDocument = (DeferredDocumentImpl)this.ownerDocument; attributes = new NamedNodeMapImpl(ownerDocument); // Default attributes dangle as children of the element // definition "node" in the internal fast table. for (int nodeIndex = ownerDocument.getLastChild(fNodeIndex); nodeIndex != -1; nodeIndex = ownerDocument.getPrevSibling(nodeIndex)) { Node attr = ownerDocument.getNodeObject(nodeIndex); attributes.setNamedItem(attr); } // set mutation events flag back to its original value ownerDocument.setMutationEvents(orig); } // synchronizeChildren()
/** * Internal subroutine to allow read-only Nodes to make their contained * NamedNodeMaps readonly too. I expect that in fact the shallow * version of this operation will never be * * @param readOnly boolean true to make read-only, false to permit editing. * @param deep boolean true to pass this request along to the contained * nodes, false to only toggle the NamedNodeMap itself. I expect that * the shallow version of this operation will never be used, but I want * to design it in now, while I'm thinking about it. */ void setReadOnly(boolean readOnly, boolean deep) { isReadOnly(readOnly); if (deep && nodes != null) { for (int i = nodes.size() - 1; i >= 0; i--) { ((NodeImpl) nodes.get(i)).setReadOnly(readOnly,deep); } } } // setReadOnly(boolean,boolean)
/** Factory method for creating a document type node. */ public DocumentTypeImpl(CoreDocumentImpl ownerDocument, String name) { super(ownerDocument); this.name = name; // DOM entities = new NamedNodeMapImpl(this); notations = new NamedNodeMapImpl(this); // NON-DOM elements = new NamedNodeMapImpl(this); } // <init>(CoreDocumentImpl,String)
Node d; if (defaults != null && (d = defaults.getNamedItem(nodeName)) != null)
/** * Introduced in DOM Level 2. <p> * Removes a node specified by local name and namespace URI. * @param namespaceURI * The namespace URI of the node to remove. * When it is null or an empty string, this * method behaves like removeNamedItem. * @param name The local name of the node to remove. * @return Node The node removed from the map if a node with such * a local name and namespace URI exists. * @throws NOT_FOUND_ERR: Raised if there is no node named * name in the map. */ public Node removeNamedItemNS(String namespaceURI, String name) throws DOMException { if (isReadOnly()) { String msg = DOMMessageFormatter.formatMessage(DOMMessageFormatter.DOM_DOMAIN, "NO_MODIFICATION_ALLOWED_ERR", null); throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR, msg); } int i = findNamePoint(namespaceURI, name); if (i < 0) { String msg = DOMMessageFormatter.formatMessage(DOMMessageFormatter.DOM_DOMAIN, "NOT_FOUND_ERR", null); throw new DOMException(DOMException.NOT_FOUND_ERR, msg); } NodeImpl n = (NodeImpl)nodes.get(i); nodes.remove(i); return n; } // removeNamedItem(String):Node
/** * Retrieve a node by name. * * @param name Name of a node to look up. * @return the Node (of unspecified sub-class) stored with that name, or * null if no value has been assigned to that name. */ public Node getNamedItem(String name) { int i = findNamePoint(name,0); return (i < 0) ? null : (Node)(nodes.get(i)); } // getNamedItem(String):Node
/** * Replicate this object. */ public Node cloneNode(boolean deep) { ElementDefinitionImpl newnode = (ElementDefinitionImpl) super.cloneNode(deep); // NamedNodeMap must be explicitly replicated to avoid sharing newnode.attributes = attributes.cloneMap(newnode); return newnode; } // cloneNode(boolean):Node
if (isReadOnly()) { String msg = DOMMessageFormatter.formatMessage(DOMMessageFormatter.DOM_DOMAIN, "NO_MODIFICATION_ALLOWED_ERR", null); throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR, msg); int i = findNamePoint(arg.getNodeName(),0); NodeImpl previous = null; if (i >= 0) {