wood burning stoves*
The moose likes XML and Related Technologies and the fly likes XML Schema to Java options Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "XML Schema to Java options" Watch "XML Schema to Java options" New topic
Author

XML Schema to Java options

Peter Chase
Ranch Hand

Joined: Oct 30, 2001
Posts: 1970
Hi,
I am about to start out on a large-ish Java application processing XML files whose content is defined by a complicated XML Schema.
I would like to be able to generate Java classes to represent the elements described in the Schema. To write these entirely by hand would be a very onerous task, so I hope that an automated tool will be able to do some of the process.
I have investigated JAXB, Castor and BreezeFactor tools for generating Java from an XML Schema. None of these could cope with our schema. One problem was that none of them supported simpleType definitions whose content was a list.
  • Are there any other such tools that I should be considering?
  • How fast are the existing tools evolving?
  • Is it likely that they will support my requirements in the near future?
  • Is there another approach that I could take to the problem?


  • All suggestions gratefully received.
    P.S. Here's an example of what JAXB and Castor didn't like...

    [ November 25, 2002: Message edited by: Peter Chase ]

    Betty Rubble? Well, I would go with Betty... but I'd be thinking of Wilma.
    Anonymous
    Ranch Hand

    Joined: Nov 22, 2008
    Posts: 18944
    Hi Peter,
    I can see one solution here: apply a simple XML transformation to conform to what is supported by Castor or JAXB to read the input XML into Java objects. To serialize, just do the reverse (another XSLT).
    I'm sure you'll find lots of experts in this forum to help you on the best way to do this.
    Cheers
    Peter Chase
    Ranch Hand

    Joined: Oct 30, 2001
    Posts: 1970

    I can see one solution here: apply a simple XML transformation to conform to what is supported by Castor or JAXB to read the input XML into Java objects. To serialize, just do the reverse (another XSLT).

    Do you mean transform the schema itself or the XML data (conforming to the schema), or both?

    I'm sure you'll find lots of experts in this forum to help you on the best way to do this.

    I do hope so!
    Balaji Loganathan
    author and deputy
    Bartender

    Joined: Jul 13, 2001
    Posts: 3150
    Originally posted by Peter Chase:

    I do hope so!

    When its comes to validation against a Schema!.. my suggestion could be to write an XSL as a validator against XML. I just attempted it but haven't completed it fully due to other works. With XSL you have an advantage of throwing out user understandble error, than the one that comes out of xerces or sun MSV.
    Rgds
    Balaji


    Spritle Software Blogs
     
    With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
     
    subject: XML Schema to Java options
     
    Similar Threads
    Generated WSDL with schema validation
    using JAXB to convert Java Object to XML
    Problems with JAXB-generated javadoc code
    Customizing JAXB
    How to get element names from schema