- public void normalizeAndIndent(InputStream in, OutputStream out) throws IOException {
- normalizeAndIndent(in, out, 2);
+ public void normalizeAndIndent(Source source, Result result) {
+ try {
+ Transformer transformer = transformerFactory.newTransformer(stripSpaceXsl);
+ transformer.setOutputProperty(OutputKeys.ENCODING, "UTF-8");
+ // transformer.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "yes");
+ transformer.setOutputProperty(OutputKeys.INDENT, "yes");
+
+ transformer.transform(source, result);
+ } catch (TransformerException e) {
+ throw new RuntimeException("Cannot strip space from " + source, e);
+ }