Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Designing XML solutions

 
U Patel
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 11962
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Kishore Dandu
Ranch Hand
Posts: 1934
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic