• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

How to bind dynamic xml with Java objects without xsd

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Can think of two options...
*DOM
*JAXB - bind xml to java objects

HTH,
Rajiv
[ October 28, 2005: Message edited by: Rajiv Rangarajan ]
 
These are not the droids you are looking for. Perhaps I can interest you in a tiny ad?
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic