aspose file tools*
The moose likes XML and Related Technologies and the fly likes Rewrite DOM to JAXB: What about UserData 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 "Rewrite DOM to JAXB: What about UserData" Watch "Rewrite DOM to JAXB: What about UserData" New topic
Author

Rewrite DOM to JAXB: What about UserData

Sverre Moe
Ranch Hand

Joined: Jul 10, 2007
Posts: 110
I'm rewriting an application which is using DOM to parse XML and replacing it with JAXB.

However the application is making use of the get/setUserData(String) on org.w3c.dom.Element to associate a Java object to the XML element.

Object org.w3c.dom.Node.setUserData(String key, Object data, UserDataHandler handler)

Associate an object to a key on this node. The object can later be retrieved from this node by calling getUserData with the same key.


Is there a solution to do this with JAXB?

Example:
JAXBElement<Widget>
Attribute:class
The userdata associated with the XML DOM element is the class defined in this attribute for this XML element.

My JAXB objects are generated from XML Schema. Perhaps I could modify the JAXBElement Widget to contain the base class for the class defined in the attribute.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Rewrite DOM to JAXB: What about UserData