University of Cincinnati logo and link  
Unmarshalling XML Content
 
  UC ingot A few classes and methods we use in the unmarshalling process...
  • JAXBContext  is the source of the Marshaller, Unmarshaller, and Validator.  To create a JAXBContext, call the newInstance method, and pass a colon separated list of packages that contain XML Schema-derived classes.
    • The createMarshaller method returns a Marshaller instance.  The Marshaller serializes the Java content trees to XML data.
      • Use the marshal method, using any one of five method signatures, to marshal a Java tree to XML. 
    • The createUnmarshaller method returns an Unmarshaller instance.  This does the opposite of the Marshaller - it converts XML to Java content trees, validating if requested to do so with the setValidating method. 
      • Use one of the unmarshal methods to unmarshall the source.  There are a number of methods available, each of which take a different input type - a File, InputStream, URL, Node, Source, or InputSource.
    • The createValidator method returns a Validator class that will validate a Java content tree against its source schema.


 JAX-RPC