public static String getSREsAsXML ( IProgressMonitor monitor ) throws CoreException { initializeSREs ( ) ; try { final DocumentBuilderFactory factory = DocumentBuilderFactory . newInstance ( ) ; final DocumentBuilder builder = factory . newDocumentBuilder ( ) ; final Document xmldocument = builder . newDocument ( ) ; final Element rootElement = getXml ( xmldocument ) ; xmldocument . appendChild ( rootElement ) ; final TransformerFactory transFactory = TransformerFactory . newInstance ( ) ; final Transformer trans = transFactory . newTransformer ( ) ; try ( ByteArrayOutputStream baos = new ByteArrayOutputStream ( ) ) { final DOMSource source = new DOMSource ( xmldocument ) ; final PrintWriter flot = new PrintWriter ( baos ) ; final StreamResult xmlStream = new StreamResult ( flot ) ; trans . transform ( source , xmlStream ) ; return new String ( baos . toByteArray ( ) ) ; } } catch ( Throwable e ) { throw new CoreException ( SARLEclipsePlugin . getDefault ( ) . createStatus ( IStatus . ERROR , e ) ) ; } }
Returns the listing of currently installed SREs as a single XML file .