public static final String ERROR_MESSAGE_FMT = "Could not convert %s to %s";
@SuppressWarnings("unchecked")
public <T> T convertToObject(String xml, Class<T> className) {
xml=xml.substring(xml.indexOf("?>") + 2);
BeanReader reader = new BeanReader();
try {
reader.registerBeanClass("activity", className);
StringReader rd = new StringReader(xml);
return (T) reader.parse(rd);
} catch (IntrospectionException e) {
throw new RuntimeException(String.format(ERROR_MESSAGE_FMT, xml, className), e);
} catch (IOException e) {
throw new RuntimeException(String.format(ERROR_MESSAGE_FMT, xml, className), e);
} catch (SAXException e) {