I have an application UI that uses XmlBeans to parse an XML document and
display the parsed "XmlObjects" in a exploreresque treeview. XmlBeans
doesn't provide much support for eventing so I am grabbing the "Document's"
DomNode to employ DOM's eventing support. From there, I am getting the
document's root element via getDocumentElement(). I then try to cast this
element to EventTarget so I can add to the interface my
org.w3c.dom.events.EventListener. However, a ClassCastException is occurring
where the cast occurs from Element to EventTarget. Below is a snippet: 

private void setupListener(final XmlObject xml) {
        org.w3c.dom.Node domNode = xml.getDomNode();
        Document document = (Document)domNode;       
        Element element = document.getDocumentElement();
        EventTarget eventTarget = (EventTarget)element;
<----------------ClassCastException occurs here
        eventTarget.addEventListener("DOMSubtreeModified", 
                new DfcXmlObjectListener(), true);
        
}
>From what I have learned, XmlBeans does not implement the EventTarget in
it's DOM implementation. I've seen a few threads about adding Eventing to an
XmlBean document, but thought that I would post here to gather if there is
preferred solution by the XmlBean community.

Thank you,
V/R
Bob Harvey


-- 
View this message in context: 
http://old.nabble.com/XmlBeans-and-DOM-Listener-tp33983653p33983653.html
Sent from the Xml Beans - Dev mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@xmlbeans.apache.org
For additional commands, e-mail: dev-h...@xmlbeans.apache.org

Reply via email to