TransformerFactory (TransformerFactory factory) { try { factory.setAttribute("http://xml.apache.org/xalan/properties/source-location", Boolean.TRUE); factory.setAttribute("http://xml.apache.org/xalan/features/optimize", Boolean.FALSE); } catch (Exception e) { // ignore } return factory; }