aspose file tools*
The moose likes XML and Related Technologies and the fly likes Designing XML solutions Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "Designing XML solutions" Watch "Designing XML solutions" New topic
Author

Designing XML solutions

U Patel
Greenhorn

Joined: Sep 28, 2004
Posts: 18
Gurus,
I have a situation where I have an iterator with bunch of java objects. I need to create XML out of that and make sure that output complies with schema. Which is no big deal. But what my question for you guys is which is the best way to go. Use XSLT to do so? or use java API to do so? No place to use JDOM at this point as other part of this application uses XSLT to output incoming XML to a fixed length record format.

And last but not least,for cost saving perposes, I am looking for something like given an iterator of objects and schema it generates XML for me.

Thanks much
Lasse Koskela
author
Sheriff

Joined: Jan 23, 2002
Posts: 11962
    
    5
I'm not aware of a tool that would generate XML from a Java object according to an arbitrary schema, but you should look at XStream, Castor and JAXB. They all provide some type of Java-to-XML serialization.


Author of Test Driven (2007) and Effective Unit Testing (2013) [Blog] [HowToAskQuestionsOnJavaRanch]
Kishore Dandu
Ranch Hand

Joined: Jul 10, 2001
Posts: 1934
If you need to comply with schema Xstream can not help much on that(unless u write a validator method before invoking Xstream).

Castor can validate on a schema before creating the xml for you. But it comes with a overhead of classes that are generated based on the xsd.


Kishore
SCJP, blog
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Designing XML solutions