• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Designing XML solutions

 
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
author
Posts: 11962
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ranch Hand
Posts: 1934
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
reply
    Bookmark Topic Watch Topic
  • New Topic