This week's giveaway is in the EJB and other Java EE Technologies forum.
We're giving away four copies of EJB 3 in Action and have Debu Panda, Reza Rahman, Ryan Cuprak, and Michael Remijan on-line!
See this thread for details.
The moose likes XML and Related Technologies and the fly likes How to bind dynamic xml with Java objects without xsd Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "How to bind dynamic xml with Java objects without xsd" Watch "How to bind dynamic xml with Java objects without xsd" New topic
Author

How to bind dynamic xml with Java objects without xsd

Larry Zheng
Greenhorn

Joined: Oct 24, 2005
Posts: 4
I have a question, and hope someone here can help me.

In my current project, I will get a xml file, containing some information of each user, and map them into a set of user objects.

For each user, there are some fixed attributes, such as name, phone#, age, position, etc. The problem is, client can customize, and add new attibutes, such as address, favorite color, so there will be no xsd for the xml.

What I want to do, is map fixed attributes to user object attributes, for example, name attribute to User.name, and they will have corresponding getters, and setters, but for custom attributes, I want to add them to a HashMap in User object, for example, use string "ADDRESS" as the key, and address as the value.

Is there any way I can do this? Thank you very much for any help you can provide.
Raj Murthy
Greenhorn

Joined: Oct 25, 2005
Posts: 14
Can think of two options...
*DOM
*JAXB - bind xml to java objects

HTH,
Rajiv
[ October 28, 2005: Message edited by: Rajiv Rangarajan ]
 
 
subject: How to bind dynamic xml with Java objects without xsd
 
Similar Threads
Question: static modelling
Java objects to XML, possibly using JAXB
Making arraylist from resultset
What event handler to use?
java.io.IOException: Type {http://lang.java}Exception is referenced but not defined.