Help coderanch get a
new server
by contributing to the fundraiser
  • 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

using XSD to generate XML document

 
Ranch Hand
Posts: 135
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I need some help with this. I have a XML schema and using this schema, I need to generate a XML Document instance in my java program. I will get the required element values some how but all I got to do is, use those values and create a XML document using the schema and return that document to the caller of the method.

All I have now is The XML Schema of the output document(that I am trying to generate) and data to be filled in the document.

I am sure there may be a simple solution and need some pointers.

I use AXIS for my webservices also if there is anything I can do using this to solve my above problem.

Appreciate time and help.

Ugender

[ May 18, 2007: Message edited by: Ugender Rekulampally ]
[ May 18, 2007: Message edited by: Ugender Rekulampally ]
 
Ranch Hand
Posts: 1061
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Have a look at JaxMe. It has a generator to create Java classes from a XSD. On runtime you fill the classes' properties with setters and "marshal" it into a XML.
hth cb
[ May 18, 2007: Message edited by: Chris Baron ]
 
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Ugender,

You might also take a quick look at JAXB (http://java.sun.com/developer/technicalArticles/WebServices/jaxb/). It allows you to take a schema and build an in-memory Java representation of the schema and set values on it. You may then marshal the XML to any one of a number of different sources. Hope this helps.
Warren
 
Ranch Hand
Posts: 2308
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
That the purpose of JAXB as mentioned by Warren Killian.

You can give schema / XSD to the schema compiler to generate the java classes for you.
 
Ugender Rekulampally
Ranch Hand
Posts: 135
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Guys for your info. I am using JAXB and having fun with it.

Ugender
 
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Try Castor(http://www.castor.org/)
 
Try 100 things. 2 will work out, but you will never know in advance which 2. This tiny ad might be one:
We need your help - Coderanch server fundraiser
https://coderanch.com/t/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic