This week's book giveaways are in the AI and JavaScript forums.
We're giving away four copies each of GANs in Action and WebAssembly in Action and have the authors on-line!
See this thread and this one for details.
Win a copy of GANs in ActionE this week in the AI forum
or WebAssembly in Action in the JavaScript forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Bear Bibeault
  • Paul Clapham
  • Jeanne Boyarsky
  • Knute Snortum
  • Liutauras Vilda
  • Tim Cooke
  • Junilu Lacar
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
  • Joe Ess
  • salvin francis
  • fred rosenberger

XML Serialization of POJOs?

Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I've been evaluation various Java <-> XML solutions as a way to serialize existing java domain objects (containing data AND behavior) to/from XML.
I started with this doc as a starting point:
And narrowed the list down from 40+ candidates to 10 contenders:
1. Castor, looks great
2. JAXB, Strong candidate based on standardness
3. JaxMe, alternative JAXB implementation
4. Jbind, but note bad performance in XML in Java: Data binding, Part 2: Performance
5. JiBX, fairly simple, clean XML output, uses byte-code instrumentation
6. Xgen, built on Castor
7. Zeus
8. Betwixt
9. KBML (Koala Bean Markup Language), KOML (Koala Object Markup Language), marginal survivor � no schema support?
10. XMLBeans
The examples I've seen of JAXB center around using an XSD as a starting point. In addition the java objects created are simple javabean-like value objects, with no behavior.
I'm starting with java objects not an XSD. I'm happy to create an XSD if needed. My dream though is to take my existing graph of domain objects and "XML-enable" them using one of these technologies.
Can JAXB fill this need? Can my domain objects extend the JAXB-generated classes perhaps, thus allowing me to keep my coded behavior? Or is there some other way to XML-enable my classes?
Posts: 11962
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Originally posted by John Lindwall:
allowing me to keep my coded behavior?

Are you really talking about serializing the class' bytecode into the resulting XML document? I can't see any other way of serializing the object's "behavior" to an XML document.
Most XML data binding solutions are based on the assumption that whoever deserializes the XML documents back into Java objects already have the Java class somewhere in the classpath -- thus, the behavior is already present and the XML document only contains the object's state.
PS. If you don't like complexity, take XStream for a test ride!
Morning came much too soon and it brought along a friend named Margarita Hangover, and a tiny ad.
Java file APIs (DOC, XLS, PDF, and many more)
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!