• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

XML Schema to Java object

 
Ashish Sarin
author
Ranch Hand
Pie
Posts: 443
10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello guys

I was trying to do something like this:
Read an XML Schema file and creat a Java object. The generated Java object contains information on which element types exist in the Schema, their possible attributes, the sub-elements it can contain, the attributes which are optional, the attributes which are required, etc etc. I mean this Java object will be the single point of contact for me to know everything about XML Schema.

Anyone can suggest me or provide some sample code to how to accomplish this kind of requirement ??

Looking forward to receive replies from you guys.

regards
ashish sarin
 
bob connolly
Ranch Hand
Posts: 204
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well i'm just a green horn about this stuff, but i think the RELAXNG tool will generate JAVA classes!

bc
 
Nathaniel Stoddard
Ranch Hand
Posts: 1258
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
JAXB was designed specifically to do this -- check out the Web Services Developer Kit on the Java website.
 
Balaji Loganathan
author and deputy
Bartender
Posts: 3150
 
bob connolly
Ranch Hand
Posts: 204
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Does anyone know which of these tools, JAXP, Castor or other, are currently being used the most to generate Schema's or build Schema's from scratch these days?

I've just been reading artilces on 'xml.com' where the W3C XML Schema approach is being compared to the RELAX NG approach and it sounds like the RNG approach is more flexible and easier to develop, does anyone have any thoughts or experience with these tools?

What i'm really hoping to find is a tool that will help me build a 'detailed' Schema and by that i mean a tool that will ask which field i want to 'enumerate' and then go ahead and insert the 'enumerations' in the Schema automatically!

For example, if i say i want to 'enumerate' the state field in the Schema, the tool will examine a database or XML file, determine the unique data values for the state field and insert an 'enumeration' entry for each state into the Schema!

Will JAXP or CASTOR help build a 'detailed' Schema along those lines or even a 'shell/template' Schema for that matter?

I have been able to generate a generic 'shell' Schema using Oracles XML kit and Oracle DB, but i havn't been able to verify if i will have to pay a licensing fee if i move it to production!

Thanks for any thoughts!
bc
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic