DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT <http://nagoya.apache.org/bugzilla/show_bug.cgi?id=7070>. ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND INSERTED IN THE BUG DATABASE.
http://nagoya.apache.org/bugzilla/show_bug.cgi?id=7070 relatedNode null on attribute removal Summary: relatedNode null on attribute removal Product: Xerces2-J Version: 2.0.1 Platform: PC OS/Version: Windows 9x Status: NEW Severity: Normal Priority: Other Component: DOM AssignedTo: [EMAIL PROTECTED] ReportedBy: [EMAIL PROTECTED] The DOM Level 2 Events spec says of the MutationEvent relatedNode: "In the case of the DOMAttrModified event it indicates the Attr node which was modified, added, or removed." The following sample app reports (incorrectly) null for the relatedNode. The relatedNode should be the Attr node for the attribute that's just been removed. Sample Code: import org.apache.xerces.parsers.*; import org.apache.xml.serialize.*; import org.w3c.dom.*; import org.w3c.dom.events.*; import org.xml.sax.InputSource; import java.io.StringReader; public class XMLBugTest implements EventListener { public static final String xmlText = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" + "<doc attr=\"name\"/>"; public static void main(String[] args) throws Exception { DOMParser parser = new DOMParser(); parser.parse(new InputSource(new StringReader(xmlText))); Document doc = parser.getDocument(); ((EventTarget) doc).addEventListener( "DOMAttrModified", new XMLBugTest(), true); doc.getDocumentElement().removeAttribute("attr"); } public void handleEvent(Event event) { MutationEvent me = (MutationEvent) event; System.out.println(me.getRelatedNode()); } } --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
