• 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
  • Ron McLeod
  • Liutauras Vilda
  • Paul Clapham
  • paul wheaton
Sheriffs:
  • Tim Cooke
  • Devaka Cooray
  • Rob Spoor
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Tim Moores
  • Carey Brown
  • Mikalai Zaikin
Bartenders:

XMLBeans: Converting JavaBeans to XML?

 
Ranch Hand
Posts: 365
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi-
we've been using XMLbeans successfully in our project for quite some time and now have a need to convert java objects back into XML, reconstructing a new XML doc from the modified beans.
Can anyone suggest the best way of going about this?
thanks!
Max
 
Bartender
Posts: 1051
5
Hibernate Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Why not give XStream a try?
 
Max Tomlinson
Ranch Hand
Posts: 365
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
thanks for the quick response, James - I'll give it a try
Max
 
Max Tomlinson
Ranch Hand
Posts: 365
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
So I've been looking at xstream and I am not sure it will do what I need:

I want to:
1) pass json as text from a client to an ejb and create a pojo - xstream can do this
2) generate xml from the pojo with xstream - xstream can do this too BUT - no namespace support - I need namespaces in my xml.

Anyone have any solutions for this (creating xml with namespaces?)

thanks!
Max
 
Marshal
Posts: 27987
94
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
There's a ton of Java-to-XML-binding tools available (and that's a clue to your google keywords ). JAXB is the most mainstream but there are others that aren't obsolete.
 
Max Tomlinson
Ranch Hand
Posts: 365
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Forget JAXB - way too complex and problematic to work with (anyone ever have fun with web services using JAXB?)
I really liked what xstream did - I just wanted it to do a bit more - handle a ns - oh well
 
Paul Clapham
Marshal
Posts: 27987
94
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You could create the XML without namespaces and then run an XSL transformation to produce a similar document with the namespace you need.

(I have to admit -- I would rather not wade into the XML Schema tarpit either.)
 
James Boswell
Bartender
Posts: 1051
5
Hibernate Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Max

Check out the link below. May provide you with a workaround to enable XStream to become namespace aware.

http://forum.springsource.org/showthread.php?47002-XStream-and-Namespaces

(5th post by tobias)
 
When people don’t understand what you are doing they call you crazy. But this tiny ad just doesn't care:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic