static final String EHCACHE_CACHE15X = "Ehcache15x";
static final String COHERENCE_35X = "Coherence35x";
static final String[] SUPPORTED_FORMATS = {JBOSS_CACHE3X, EHCACHE_CACHE15X, EHCACHE_CACHE16X, COHERENCE_35X};
public void parse(InputStream is, OutputStream os, String xsltFile) throws Exception {
InputStream xsltInStream = new FileLookup().lookupFile(xsltFile);
if (xsltInStream == null) {
throw new IllegalStateException("Cold not find xslt file! : " + xsltFile);
}
Document document = getInputDocument(is);
// Use a Transformer for output
Transformer transformer = getTransformer(xsltInStream);
DOMSource source = new DOMSource(document);
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
StreamResult result = new StreamResult(byteArrayOutputStream);
transformer.transform(source, result);
InputStream indentation = new FileLookup().lookupFile("xslt/indent.xslt");
// Use a Transformer for output
transformer = getTransformer(indentation);
StreamResult finalResult = new StreamResult(os);
StreamSource rawResult = new StreamSource(new ByteArrayInputStream(byteArrayOutputStream.toByteArray()));
transformer.transform(rawResult, finalResult);