A quick and dirty way to convert Java objects to and from XML

The process to marshal or serialize an object to XML can differ greatly from language to language and implementation to implementation. Even within a single language, like Java, there are multiple ways to go about it. I happened to stumble upon this one the other day and thought it was pretty straight forward. This example contains two classes XMLExample.java and Example.java. We will use the functions in XMLExample.java to convert Example.