/** * Releases the DOM caching associated XMLObject and its ancestors. */ private void releaseDOM() { attributeOwner.releaseDOM(); attributeOwner.releaseParentDOM(true); }
/** * Releases the DOM caching associated XMLObject and its ancestors. */ private void releaseDOM() { attributeOwner.releaseDOM(); attributeOwner.releaseParentDOM(true); }
/** {@inheritDoc} */ public void releaseParentDOM(boolean propagateRelease) { log.trace("Releasing cached DOM reprsentation for parent of {} with propagation set to {}", getElementQName(), propagateRelease); XMLObject parentElement = getParent(); if (parentElement != null) { parent.releaseDOM(); if (propagateRelease) { parent.releaseParentDOM(propagateRelease); } } }
/** {@inheritDoc} */ public void releaseParentDOM(boolean propagateRelease) { log.trace("Releasing cached DOM reprsentation for parent of {} with propagation set to {}", getElementQName(), propagateRelease); XMLObject parentElement = getParent(); if (parentElement != null) { parent.releaseDOM(); if (propagateRelease) { parent.releaseParentDOM(propagateRelease); } } }
/** {@inheritDoc} */ public ElementType remove(int index) { ElementType element = elements.remove(index); if (element != null) { element.releaseParentDOM(true); element.setParent(null); parent.getIDIndex().deregisterIDMappings(element.getIDIndex()); } modCount++; return element; }
/** {@inheritDoc} */ public ElementType remove(int index) { ElementType element = elements.remove(index); if (element != null) { element.releaseParentDOM(true); element.setParent(null); parent.getIDIndex().deregisterIDMappings(element.getIDIndex()); } modCount++; return element; }
/** * Assigned the parent, given at list construction, to the given element if the element does not have a parent or * its parent matches the one given at list construction time. * * @param element the element to set the parent on * * @throws IllegalArgumentException thrown if the given element already has a parent and it is different than the * parent given at list construction time */ protected void setParent(ElementType element) throws IllegalArgumentException { XMLObject elemParent = element.getParent(); if (elemParent != null && elemParent != parent) { throw new IllegalArgumentException(element.getElementQName() + " is already the child of another XMLObject and may not be inserted in to this list"); } element.setParent(parent); element.releaseParentDOM(true); } }
/** * Assigned the parent, given at list construction, to the given element if the element does not have a parent or * its parent matches the one given at list construction time. * * @param element the element to set the parent on * * @throws IllegalArgumentException thrown if the given element already has a parent and it is different than the * parent given at list construction time */ protected void setParent(ElementType element) throws IllegalArgumentException { XMLObject elemParent = element.getParent(); if (elemParent != null && elemParent != parent) { throw new IllegalArgumentException(element.getElementQName() + " is already the child of another XMLObject and may not be inserted in to this list"); } element.setParent(parent); element.releaseParentDOM(true); } }
/** * Removes the element from the list. * * @param element the element to be removed * * @return true if the element was in the list and removed, false if not */ public boolean remove(ElementType element) { boolean elementRemoved = false; elementRemoved = elements.remove(element); if (elementRemoved) { if (element != null) { element.releaseParentDOM(true); element.setParent(null); parent.getIDIndex().deregisterIDMappings(element.getIDIndex()); } } return elementRemoved; }
/** * Removes the element from the list. * * @param element the element to be removed * * @return true if the element was in the list and removed, false if not */ public boolean remove(ElementType element) { boolean elementRemoved = false; elementRemoved = elements.remove(element); if (elementRemoved) { if (element != null) { element.releaseParentDOM(true); element.setParent(null); parent.getIDIndex().deregisterIDMappings(element.getIDIndex()); } } return elementRemoved; }
/** * Prepares the given DOM caching XMLObject for adoption into another document. If the XMLObject has a parent then * all visible namespaces used by the given XMLObject and its descendants are declared within that subtree and the * parent's DOM is invalidated. * * @param domCachingObject the XMLObject to prepare for adoption * * @throws MarshallingException thrown if a namespace within the XMLObject's DOM subtree can not be resolved. */ private void prepareForAdoption(XMLObject domCachingObject) throws MarshallingException { if (domCachingObject.getParent() != null) { log.trace("Rooting all visible namespaces of XMLObject {} before adding it to new parent Element", domCachingObject.getElementQName()); try { XMLHelper.rootNamespaces(domCachingObject.getDOM()); } catch (XMLParserException e) { String errorMsg = "Unable to root namespaces of cached DOM element, " + domCachingObject.getElementQName(); log.error(errorMsg, e); throw new MarshallingException(errorMsg, e); } log.trace("Release DOM of XMLObject parent"); domCachingObject.releaseParentDOM(true); } } }
/** * Prepares the given DOM caching XMLObject for adoption into another document. If the XMLObject has a parent then * all visible namespaces used by the given XMLObject and its descendants are declared within that subtree and the * parent's DOM is invalidated. * * @param domCachingObject the XMLObject to prepare for adoption * * @throws MarshallingException thrown if a namespace within the XMLObject's DOM subtree can not be resolved. */ private void prepareForAdoption(XMLObject domCachingObject) throws MarshallingException { if (domCachingObject.getParent() != null) { log.trace("Rooting all visible namespaces of XMLObject {} before adding it to new parent Element", domCachingObject.getElementQName()); try { XMLHelper.rootNamespaces(domCachingObject.getDOM()); } catch (XMLParserException e) { String errorMsg = "Unable to root namespaces of cached DOM element, " + domCachingObject.getElementQName(); log.error(errorMsg, e); throw new MarshallingException(errorMsg, e); } log.trace("Release DOM of XMLObject parent"); domCachingObject.releaseParentDOM(true); } } }
xmlObject.releaseParentDOM(true);
xmlObject.releaseParentDOM(true);
xmlObject.releaseParentDOM(true);
xmlObject.releaseParentDOM(true);