Win a copy of Practical SVG this week in the HTML/CSS/JavaScript 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: 13078
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: 21892
36
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.
 
Think of how stupid the average person is. And how half of them are stupider than that. But who reads this tiny ad?
the new thread boost feature: great for the advertiser and smooth for the coderanch user
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!