This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line!
See this thread for details.
The moose likes XML and Related Technologies and the fly likes XmlBeans and DOM Listener Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "XmlBeans and DOM Listener" Watch "XmlBeans and DOM Listener" New topic
Author

XmlBeans and DOM Listener

Robert Harvey
Greenhorn

Joined: Nov 18, 2011
Posts: 8
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:



Any help is much appreciated - Thanks!
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 13001
    
    5
From the EventTarget documentation, this would appear to indicate that your DOM implementation does not implement the EventTarget interface.

Bill
Robert Harvey
Greenhorn

Joined: Nov 18, 2011
Posts: 8
Thanks Bill - I was afraid that this was the case.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: XmlBeans and DOM Listener
 
jQuery in Action, 3rd edition