Win a copy of Learn Spring Security (video course) this week in the Spring forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

using XSD to generate XML document

 
Ugender Rekulampally
Ranch Hand
Posts: 135
  • Mark post as helpful
  • send pies
  • 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 ]
 
Chris Baron
Ranch Hand
Posts: 1061
  • Mark post as helpful
  • send pies
  • 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 ]
 
The Dunce Baron
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • 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
 
Rahul Bhattacharjee
Ranch Hand
Posts: 2308
  • Mark post as helpful
  • send pies
  • 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
  • Quote
  • Report post to moderator
Thanks Guys for your info. I am using JAXB and having fun with it.

Ugender
 
raj vin
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try Castor(http://www.castor.org/)
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic