aspose file tools*
The moose likes XML and Related Technologies and the fly likes Is it possible to create a XML document using just a XSD in Java Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "Is it possible to create a XML document using just a XSD in Java" Watch "Is it possible to create a XML document using just a XSD in Java" New topic
Author

Is it possible to create a XML document using just a XSD in Java

Tony Evans
Ranch Hand

Joined: Jun 29, 2002
Posts: 579
I am creating a generated Error response, sitting on top of functionality that takes a empty at the moment hard coded XML, and puts the error messages in.
What I want to do is rather than hard code the XML just generate it from an error response XSD.

If this is not possible I can use JIBX or JAXB to to generate the response XML, this will mean bypassing the underlying functionality. It will mean dependancies on more jars JIBX or JAXB.

Before I can down the POJO to XML route just want to see is there a stright XSD to XML route.

Thanks Tony

William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12803
    
    5
Short answer - no - this gets asked a lot. An XSD document does not define a unique XML document.

If you already have a known valid template XML document, why not use it I guarantee it will be faster than any generation scheme.

Bill

Tony Evans
Ranch Hand

Joined: Jun 29, 2002
Posts: 579
Actually since this is a rather lite weight XML a basic error response, I am still using a pojo and using XMLStream to stream it into XML
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18651
    
    8

Light-weight? Then you definitely don't want to be dragging heavy-duty things like schemas into the picture. Sounds like you need to keep it simple.
Tony Evans
Ranch Hand

Joined: Jun 29, 2002
Posts: 579
Yes in fact because of the very tight performance issues rather a lot of traffic , we are thinking of just using stringbuilder to build the XML responses.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Is it possible to create a XML document using just a XSD in Java