Index: src/org/apache/xml/security/utils/IdResolver.java =================================================================== --- src/org/apache/xml/security/utils/IdResolver.java (revision 997314) +++ src/org/apache/xml/security/utils/IdResolver.java (working copy) @@ -64,6 +64,7 @@ * @param element the element to register * @param idValue the value of the ID attribute */ + @SuppressWarnings({ "rawtypes", "unchecked" }) public static void registerElementById(Element element, String idValue) { Document doc = element.getOwnerDocument(); WeakHashMap elementMap; @@ -76,6 +77,18 @@ } elementMap.put(idValue, new WeakReference(element)); } + + /** + * Force a removal of a registered document. Any element id associated + * with this document will be removed from the weak reference map. + * + * @param doc the DOM document that is to be removed from the map. + */ + public static void unregisterDocument(Document doc) { + synchronized (docMap) { + docMap.remove(doc); + } + } /** * Method registerElementById @@ -149,6 +162,7 @@ * @param id the value of the ID * @return the element obtained by the id, or null if it is not found. */ + @SuppressWarnings("rawtypes") private static Element getElementByIdType(Document doc, String id) { if (log.isDebugEnabled()) log.debug("getElementByIdType() Search for ID " + id);