/** * Test whether this node has any children. Convenience shorthand * for (Node.getFirstChild()!=null) */ public boolean hasChildNodes() { if (needsSyncChildren()) { synchronizeChildren(); } return value != null; }
/** Serialize object. */ private void writeObject(ObjectOutputStream out) throws IOException { // synchronize chilren if (needsSyncChildren()) { synchronizeChildren(); } // write object out.defaultWriteObject(); } // writeObject(ObjectOutputStream)
/** * Obtain a NodeList enumerating all children of this node. If there * are none, an (initially) empty NodeList is returned. * <p> * NodeLists are "live"; as children are added/removed the NodeList * will immediately reflect those changes. Also, the NodeList refers * to the actual nodes, so changes to those nodes made via the DOM tree * will be reflected in the NodeList and vice versa. * <p> * In this implementation, Nodes implement the NodeList interface and * provide their own getChildNodes() support. Other DOMs may solve this * differently. */ public NodeList getChildNodes() { // JKESS: KNOWN ISSUE HERE if (needsSyncChildren()) { synchronizeChildren(); } return this; } // getChildNodes():NodeList
/** The first child of this Node, or null if none. */ public Node getFirstChild() { if (needsSyncChildren()) { synchronizeChildren(); } makeChildNode(); return (Node) value; } // getFirstChild():Node
/** The last child of this Node, or null if none. */ public Node getLastChild() { if (needsSyncChildren()) { synchronizeChildren(); } return lastChild(); } // getLastChild():Node
/** * NON-DOM * set the ownerDocument of this node and its children */ protected void setOwnerDocument(CoreDocumentImpl doc) { if (needsSyncChildren()) { synchronizeChildren(); } super.setOwnerDocument(doc); if (!hasStringValue()) { for (ChildNode child = (ChildNode) value; child != null; child = child.nextSibling) { child.setOwnerDocument(doc); } } }
public Node cloneNode(boolean deep) { if (needsSyncChildren()) { synchronizeChildren(); } AttrImpl clone = (AttrImpl) super.cloneNode(deep); // take care of case where there are kids if (!clone.hasStringValue()) { // Need to break the association w/ original kids clone.value = null; // Cloning an Attribute always clones its children, // since they represent its value, no matter whether this // is a deep clone or not for (Node child = (Node) value; child != null; child = child.getNextSibling()) { clone.appendChild(child.cloneNode(true)); } } clone.isSpecified(true); return clone; }
/** * Override default behavior so that if deep is true, children are also * toggled. * @see Node * <P> * Note: this will not change the state of an EntityReference or its * children, which are always read-only. */ public void setReadOnly(boolean readOnly, boolean deep) { super.setReadOnly(readOnly, deep); if (deep) { if (needsSyncChildren()) { synchronizeChildren(); } if (hasStringValue()) { return; } // Recursively set kids for (ChildNode mykid = (ChildNode) value; mykid != null; mykid = mykid.nextSibling) { if (mykid.getNodeType() != Node.ENTITY_REFERENCE_NODE) { mykid.setReadOnly(readOnly,true); } } } } // setReadOnly(boolean,boolean)