Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
Tony Evans
Ranch Hand
Posts: 598
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 13062
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 598
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Sheriff
Posts: 21107
32
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 598
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic