public void setTextContent(String textContent) throws DOMException { // get rid of any existing children Node child; while ((child = getFirstChild()) != null) { removeChild(child); } // create a Text node to hold the given content if (textContent != null && textContent.length() != 0){ appendChild(ownerDocument().createTextNode(textContent)); } }
/** * 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
void getTextContent(StringBuffer buf) throws DOMException { Node child = getFirstChild(); while (child != null) { if (hasTextContent(child)) { ((NodeImpl) child).getTextContent(buf); } child = child.getNextSibling(); } }
public String getTextContent() throws DOMException { Node child = getFirstChild(); if (child != null) { Node next = child.getNextSibling(); if (next == null) { return hasTextContent(child) ? ((NodeImpl) child).getTextContent() : ""; } StringBuffer buf = new StringBuffer(); getTextContent(buf); return buf.toString(); } return ""; }
insertBefore(newChild.getFirstChild(), refChild); removeChild(newChild); insertBefore(newChild, refChild); return newChild; if (needsSyncChildren()) { synchronizeChildren(); if (isReadOnly()) { throw new DOMException( DOMException.NO_MODIFICATION_ALLOWED_ERR, changed(); checkNormalizationAfterInsert(newInternal);
/** * returns the first child node that implements the given class. * * @param <T> * The type of the ODF element to be found. * @param clazz * is a class that extends OdfElement. * @param parentNode * is the parent O of the children to be found. * @return the first child node of the given parentNode that is a clazz or * null if none is found. */ @SuppressWarnings("unchecked") static public <T extends OdfElement> T findFirstChildNode(Class<T> clazz, Node parentNode) { if (parentNode != null && parentNode instanceof ParentNode) { Node node = ((ParentNode) parentNode).getFirstChild(); while ((node != null) && !clazz.isInstance(node)) { node = node.getNextSibling(); } if (node != null) { return (T) node; } } return null; }
throws DOMException { CoreDocumentImpl ownerDocument = ownerDocument(); if (ownerDocument.errorChecking) { if (isReadOnly()) { throw new DOMException( DOMException.NO_MODIFICATION_ALLOWED_ERR, oldInternal.previousSibling = null; changed(); checkNormalizationAfterRemove(oldPreviousSibling);
if (needsSyncChildren()) { synchronizeChildren(); child != null; child = child.nextSibling) { newnode.appendChild(child.cloneNode(true));
return super.getFeature(feature, version);
/** * returns the first child node that implements the given class. * * @param <T> * The type of the ODF element to be found. * @param clazz * is a class that extends OdfElement. * @param parentNode * is the parent O of the children to be found. * @return the first child node of the given parentNode that is a clazz or * null if none is found. */ @SuppressWarnings("unchecked") static public <T extends OdfElement> T findFirstChildNode(Class<T> clazz, Node parentNode) { if (parentNode != null && parentNode instanceof ParentNode) { Node node = ((ParentNode) parentNode).getFirstChild(); while ((node != null) && !clazz.isInstance(node)) { node = node.getNextSibling(); } if (node != null) { return (T) node; } } return null; }
/** * returns the first child node that implements the given class. * * @param <T> * The type of the ODF element to be found. * @param clazz * is a class that extends OdfElement. * @param parentNode * is the parent O of the children to be found. * @return the first child node of the given parentNode that is a clazz or * null if none is found. */ @SuppressWarnings("unchecked") static public <T extends OdfElement> T findFirstChildNode(Class<T> clazz, Node parentNode) { if (parentNode != null && parentNode instanceof ParentNode) { Node node = ((ParentNode) parentNode).getFirstChild(); while ((node != null) && !clazz.isInstance(node)) { node = node.getNextSibling(); } if (node != null) { return (T) node; } } return null; }
/** Clone node. */ public Node cloneNode(boolean deep) { EntityImpl newentity = (EntityImpl)super.cloneNode(deep); newentity.setReadOnly(true, deep); return newentity; }
/** * DOM Level 3 WD- Experimental. * Override inherited behavior from NodeImpl to support deep equal. */ public boolean isEqualNode(Node arg) { if (!super.isEqualNode(arg)) { return false; } // there are many ways to do this test, and there isn't any way // better than another. Performance may vary greatly depending on // the implementations involved. This one should work fine for us. Node child1 = getFirstChild(); Node child2 = arg.getFirstChild(); while (child1 != null && child2 != null) { if (!child1.isEqualNode(child2)) { return false; } child1 = child1.getNextSibling(); child2 = child2.getNextSibling(); } if (child1 != child2) { return false; } return true; }
/** Clone node. */ public Node cloneNode(boolean deep) { EntityReferenceImpl er = (EntityReferenceImpl)super.cloneNode(deep); er.setReadOnly(true, deep); return er; }
if (containerElement != null && containerElement instanceof ParentNode) { Node node = ((ParentNode) containerElement).getFirstChild(); while ((node != null) && !FormTextareaElement.class.isInstance(node)
/** * Return a duplicate copy of this Element. Note that its children * will not be copied unless the "deep" flag is true, but Attributes * are <i>always</i> replicated. * * @see org.w3c.dom.Node#cloneNode(boolean) */ public Node cloneNode(boolean deep) { ElementImpl newnode = (ElementImpl) super.cloneNode(deep); // Replicate NamedNodeMap rather than sharing it. if (attributes != null) { newnode.attributes = (AttributeMap) attributes.cloneMap(newnode); } return newnode; } // cloneNode(boolean):Node
if (containerElement != null && containerElement instanceof ParentNode) { Node node = ((ParentNode) containerElement).getFirstChild(); while ((node != null) && !FormTextareaElement.class.isInstance(node)
/** 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