public static String marshalResourceAsString(ManagedConnectionFactoryDeploymentGroup group) throws Exception
{
Class[] classes = {ManagedConnectionFactoryDeploymentGroup.class, ManagedConnectionFactoryDeploymentMetaData.class, LocalDataSourceDeploymentMetaData.class, NonXADataSourceDeploymentMetaData.class, DataSourceDeploymentMetaData.class};
JAXBContext context = JAXBContext.newInstance(classes);
Marshaller m = context.createMarshaller();
JAXBElement element = new JAXBElement(new QName("", "datasources"), group.getClass(), group);
StringWriter w = new StringWriter();
m.marshal(element, w);
return w.toString();
}