wood burning stoves 2.0*
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 Android Security Essentials Live Lessons this week in the Android 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: 18541
    
    8

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...
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: The Age-old question: Persisting POJOs to XML
 
Similar Threads
java, xml schema and relation db
XML Verification question
using XSD to generate XML document
writing xml document using xml schema using Eclipse
How to bind JAXB persistant objects to WS parameters?