aspose file tools*
The moose likes XML and Related Technologies and the fly likes using XSD to generate XML document 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 "using XSD to generate XML document" Watch "using XSD to generate XML document" New topic
Author

using XSD to generate XML document

Ugender Rekulampally
Ranch Hand

Joined: Nov 14, 2005
Posts: 130
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 ]
Chris Baron
Ranch Hand

Joined: Mar 21, 2003
Posts: 1049
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 ]
The Dunce Baron
Greenhorn

Joined: Apr 19, 2007
Posts: 9
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
Rahul Bhattacharjee
Ranch Hand

Joined: Nov 29, 2005
Posts: 2308
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.


Rahul Bhattacharjee
LinkedIn - Blog
Ugender Rekulampally
Ranch Hand

Joined: Nov 14, 2005
Posts: 130
Thanks Guys for your info. I am using JAXB and having fun with it.

Ugender
raj vin
Greenhorn

Joined: Mar 17, 2007
Posts: 12
Try Castor(http://www.castor.org/)
 
Don't get me started about those stupid light bulbs.
 
subject: using XSD to generate XML document