try {
Class beanFactory = Class.forName(clazz.getCanonicalName() + ".Factory");
return beanFactory.getMethod("parse", XMLStreamReader.class)
.invoke(elmt.getXMLStreamReaderWithoutCaching());
} catch (ClassNotFoundException e) {
throw new OdeFault("Couldn't find class " + clazz.getCanonicalName() + ".Factory to instantiate xml bean", e);
} catch (IllegalAccessException e) {
throw new OdeFault("Couldn't access class " + clazz.getCanonicalName() + ".Factory to instantiate xml bean", e);
} catch (InvocationTargetException e) {
throw new OdeFault("Couldn't access xml bean parse method on class " + clazz.getCanonicalName() + ".Factory " +
"to instantiate xml bean", e);
} catch (NoSuchMethodException e) {
throw new OdeFault("Couldn't find xml bean parse method on class " + clazz.getCanonicalName() + ".Factory " +
"to instantiate xml bean", e);
}
} else throw new OdeFault("Couldn't use element " + elmt + " to obtain a management method parameter.");
}