The example below unmarshals an XML file (foo.xml) and then marshals it on the console.

Java Code:
JAXBContext jc = JAXBContext.newInstance( "com.acme.foo" );

Unmarshaller u = jc.createUnmarshaller();
FooObject fooObj = (FooObject)u.unmarshal( new File( "foo.xml" ) );

Marshaller m = jc.createMarshaller();
m.marshal( fooObj, System.out );