public static String clientConfigToXml(final ClientConfigList clientCfgList) throws CodeGenFailedException { final StringWriter writer = new StringWriter(); try { final JavaXmlBinder javaXmlBinder = JavaXmlBindingFactory.getInstance(); javaXmlBinder.generateClientConfigXml(clientCfgList, writer); } catch (final Exception ex) { throw new CodeGenFailedException("Failed to generate Client Config xml file", ex); } return writer.toString(); }
public static void generateClientConfigXml( ClientConfigList clientCfgList, String destLoc, String configFileName) throws CodeGenFailedException { Writer fileWriter = null; try { fileWriter = CodeGenUtil.getFileWriter(destLoc, configFileName); JavaXmlBinder javaXmlBinder = JavaXmlBindingFactory.getInstance(); javaXmlBinder.generateClientConfigXml(clientCfgList, fileWriter); } catch (Exception ex) { throw new CodeGenFailedException("Failed to generate Client Config xml file", ex); } finally { CodeGenUtil.closeQuietly(fileWriter); } }