There was a good article related to this on IBM Developerworks that may help http://www.ibm.com/developerworks/xml/library/x-xmlbeanse/index.html Please let the list know if you are still having troubles. -jacobd
On Fri, Jun 8, 2012 at 12:59 PM, harvero <robert.l.harvey...@gmail.com> 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 > 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 > --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@xmlbeans.apache.org For additional commands, e-mail: dev-h...@xmlbeans.apache.org