Get the tools you need to learn Java skills fast!
Video tutorials, eBooks, hands-on lab exercises, sample code.
Get started
The moose likes XML and Related Technologies and the fly likes The Age-old question: Persisting POJOs to XML Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Software Craftsman this week in the Agile forum!
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "The Age-old question: Persisting POJOs to XML" Watch "The Age-old question: Persisting POJOs to XML" New topic
Author

The Age-old question: Persisting POJOs to XML

Philippe Desrosiers
Ranch Hand

Joined: Mar 29, 2006
Posts: 138
I'm sure this question must have been asked a zillion times by now, but:

Given an XML Schema (.xsd) file, I'd like to generate a POJO that can be persisted to a compliant XML document. Are there any code generation tools that will help me do this? The perfect-world scenario would be an ANT task or something, that I could feed the url of the schema, and generate a JAVA class that I can persist (either using a generated persistence method, or else regular old Java persistence) to a schema-compliant XML document.

Does this request even make any sense?
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 19357
    
  10

Yes, you're right, the question has been asked a zillion times. And it's been answered in the form of working implementations -- not quite a zillion times, but still quite a few times. Did you not find any of them in your searches? I assure you, there are several.
Philippe Desrosiers
Ranch Hand

Joined: Mar 29, 2006
Posts: 138
Thanks Paul. Yeah, I was figuring on using a JAXB Ant task, but all the articles I can find are at least five years old, and most don't show examples, or talk about "unarshalling Java Content Trees" and the like. Way over my head...

UPDATE: Finally figured out how to use the JAXB XJC task. Now just have to try and wire it up to my JAX-WS implementation...
 
Have you tried LearnNowOnline? http://www.learnnowonline.com/
 
subject: The Age-old question: Persisting POJOs to XML