Document document = null;
if (text != null
&& text.length() > 0) {
try {
PlainTextSerializer serializer = new PlainTextSerializer();
StringReader reader = new StringReader(text);
document = serializer.readObject(reader);
} catch(SerializationException exception) {
throw new RuntimeException(exception);
} catch(IOException exception) {
throw new RuntimeException(exception);
}