There was a good article related to this on IBM Developerworks that may help
Please let the list know if you are still having troubles.

On Fri, Jun 8, 2012 at 12:59 PM, harvero <> wrote:
> 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
> 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: 
> Sent from the Xml Beans - Dev mailing list archive at
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> For additional commands, e-mail:

To unsubscribe, e-mail:
For additional commands, e-mail:

Reply via email to