JAXB 

 

JAX-WS delegates the mapping of Java programming language types to and from XML definitions to JAXB. Application developers should be aware that not every class in the Java language can be used as a method parameter or return type in JAX-WS. 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

The JAXB XJC schema binding compiler transforms, or binds, a source XML schema to a set of JAXB content classes in the Java programming language. 

 

xjc [-options ...] schema

The JAXB Schema Generator, schemagen, creates a schema file for each namespace referenced in your Java classes.

 

schemagen [-d path] [java-source-files]

for a package primer.po.* create JAXBContent for marshalling and unmarshalling : 

 

JAXBContext jc = JAXBContext.newInstance( "primer.po" );

Unmarshall : 

 

Unmarshaller u = jc.createUnmarshaller(); 

PurchaseOrder po = (PurchaseOrder)u.unmarshal( new FileInputStream("po.xml"));