Win a copy of The Way of the Web Tester: A Beginner's Guide to Automating Tests this week in the Testing forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Rewrite DOM to JAXB: What about UserData

Sverre Moe
Ranch Hand
Posts: 110
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?

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.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic