my dog learned polymorphism*
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


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
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: 12759
    
    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.
 
Consider Paul's rocket mass heater.
 
subject: XmlBeans and DOM Listener
 
Similar Threads
how to throw out a exception while implementing an abstract method?
Issue in Parsing the xml file using xmlBeans
Compariosn between different Java Object XML Binding Framework
Displaying DOM using swing
XML to DOM to JTree