public Object doDeserialize(SerializedObject serializedObject, XStream xStream) {
if ("org.dom4j.Document".equals(serializedObject.getContentType().getName())) {
return xStream.unmarshal(new Dom4JReader((org.dom4j.Document) serializedObject.getData()));
}
if("nu.xom.Document".equals(serializedObject.getContentType().getName())) {
return xStream.unmarshal(new XomReader((nu.xom.Document) serializedObject.getData()));
}
InputStream serializedData = convert(serializedObject.getContentType(), InputStream.class,
serializedObject.getData());
return xStream.fromXML(new InputStreamReader(serializedData, getCharset()));
}