This week's book giveaway is in the Android forum.
We're giving away four copies of Head First Android and have David & Dawn Griffiths on-line!
See this thread for details.
Win a copy of Head First Android this week in the Android forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Rob Spoor
  • Devaka Cooray
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
  • Tim Holloway
Bartenders:
  • Jj Roberts
  • Al Hobbs
  • Piet Souris

How to genrate classes from xsd?

 
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi
I am new to web service technology.
I want to know how to generate the java classes from
XSD.
Which tools are used for web service operations?
 
Bartender
Posts: 2968
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by swarupa patil:
Which tools are used for web service operations?



When dealing with SOAP based web services you need a WSDL to create a stub with a WSDL2Java compiler.
The WSDL refers to XML Schemas but the schemas themselves are not enough.
What that WSDL2Java compiler is called depends on the web service toolkit that you are using.

I want to know how to generate the java classes from XSD.



Now if you are simply retrieving an XML document over an HTTP connection then you can use JAXB to do the (un)marshalling.

With the JVM 1.4 you can use JAXB 1.0.x
JAXB 1.0 tutorial
Chapter 1: Binding XML Schema to Java Classes with JAXB
Chapter 2: Using JAXB

With the JVM 1.5 you can use JAXB 2
JAXB 2.0 tutorial
Binding between XML Schema and Java Classes
 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You can also use XmlBeans from appache http://xmlbeans.apache.org/.
 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You can use XMLbeans. to use this you need to download from http://download.nextag.com/apache/xmlbeans/binaries/

you can download xmlbeans-2.3.0.zip

once you download you need to place your xsd in the bin of the extract and run scomp -out jarname.jar xsdname.xsd (make sure that you point the scomp to the java home by editing it)

a jar will be generated in the bin. add this jar and the lib jars from the extract to your class path. the jar will contain class for the XSD
 
Ranch Hand
Posts: 186
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
Which one is better whether to use XMLBeans or JAXB. What is the difference between the two.
regards
sudha
 
Peer Reynders
Bartender
Posts: 2968
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by sudha swami:
Which one is better whether to use XMLBeans or JAXB. What is the difference between the two.



JAXB is part of the standard Java distribution starting with Java SE 6 and Java EE 5. XmlBeans is an open source project that predates JAXB - it will always be separate and never be part of the standard Java distribution.

JAXB 1.0 requires Java 1.4. JAXB 2.0 requires Java 1.5. Some XmlBeans versions probably work with pre-1.4.
 
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic