public void setAttribute(String name, Object value) throws IllegalArgumentException { // GTM: NB: 'debug' should change to something more unique... if ((name.equals("translet-name")) || (name.equals("debug"))) { if (_xsltcFactory == null) { createXSLTCTransformerFactory(); } _xsltcFactory.setAttribute(name, value); } else { if (_xalanFactory == null) { createXalanTransformerFactory(); } _xalanFactory.setAttribute(name, value); } }
stf.setAttribute(XalanProperties.SOURCE_LOCATION, Boolean.TRUE); stf.setAttribute(org.apache.xalan.processor.TransformerFactoryImpl.FEATURE_INCREMENTAL, Boolean.TRUE);
public void setAttribute(String name, Object value) throws IllegalArgumentException { // GTM: NB: 'debug' should change to something more unique... if ((name.equals("translet-name")) || (name.equals("debug"))) { if (_xsltcFactory == null) { createXSLTCTransformerFactory(); } _xsltcFactory.setAttribute(name, value); } else { if (_xalanFactory == null) { createXalanTransformerFactory(); } _xalanFactory.setAttribute(name, value); } }
public void setAttribute(String name, Object value) throws IllegalArgumentException { // GTM: NB: 'debug' should change to something more unique... if ((name.equals("translet-name")) || (name.equals("debug"))) { if (_xsltcFactory == null) { createXSLTCTransformerFactory(); } _xsltcFactory.setAttribute(name, value); } else { if (_xalanFactory == null) { createXalanTransformerFactory(); } _xalanFactory.setAttribute(name, value); } }
public void setAttribute(String name, Object value) throws IllegalArgumentException { // GTM: NB: 'debug' should change to something more unique... if ((name.equals("translet-name")) || (name.equals("debug"))) { if (_xsltcFactory == null) { createXSLTCTransformerFactory(); } _xsltcFactory.setAttribute(name, value); } else { if (_xalanFactory == null) { createXalanTransformerFactory(); } _xalanFactory.setAttribute(name, value); } }
/** * @param fileName * @return a SAX handler for the given file. * @throws FileNotFoundException * @throws TransformerConfigurationException */ protected ContentHandler getHandler(final String fileName) throws FileNotFoundException, TransformerConfigurationException { new File(this.baseDir).mkdirs(); String filePath = this.baseDir + fileName; PrintWriter out = new PrintWriter(filePath); StreamResult streamResult = new StreamResult(out); SAXTransformerFactory tf = (SAXTransformerFactory) TransformerFactory.newInstance(); try { tf.setAttribute("indent-number", new Integer(2)); } catch (Exception ex) { } TransformerHandler hd = tf.newTransformerHandler(); Transformer serializer = hd.getTransformer(); serializer.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "yes"); serializer.setOutputProperty(OutputKeys.ENCODING, "ISO-8859-1"); serializer.setOutputProperty(OutputKeys.INDENT, "yes"); serializer.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "8"); hd.setResult(streamResult); return hd; }
private void load(final Source source, final String localCacheKey, final Map<String, Object> attributes) { LOG.debug("{} local cache miss: {}", getClass().getSimpleName(), localCacheKey); // XSLT has to be parsed final SAXTransformerFactory transformerFactory; if (attributes == null || attributes.isEmpty()) { transformerFactory = TRAX_FACTORY; } else { transformerFactory = createNewSAXTransformerFactory(); attributes.forEach((key, values) -> { transformerFactory.setAttribute(key, values); }); } try { this.templates = transformerFactory.newTemplates(source); } catch (TransformerConfigurationException e) { throw new SetupException("Impossible to read XSLT from '" + source + "', see nested exception", e); } }
private static ContentHandler createHandler(Writer out) { SAXTransformerFactory factory; TransformerHandler transformer; // Initializes the transformer factory. factory = (SAXTransformerFactory)SAXTransformerFactory.newInstance(); factory.setAttribute("indent-number", 4); // Creates a new transformer. try {transformer = factory.newTransformerHandler();} catch(TransformerConfigurationException e) {throw new IllegalStateException(e);} // Enables indentation. transformer.getTransformer().setOutputProperty(OutputKeys.INDENT, "yes"); // Sets the standalone property. transformer.getTransformer().setOutputProperty(OutputKeys.STANDALONE, "yes"); // Plugs the transformer into the specified stream. transformer.setResult(new StreamResult(out)); return transformer; }
_factory.setAttribute("http://xml.apache.org/xalan/features/incremental", Boolean.valueOf(m_incrementalProcessing)); _factory.setAttribute("http://saxon.sf.net/feature/version-warning", Boolean.FALSE);
public static SAXTransformerFactory createSaxTransformerFactory() { SAXTransformerFactory saxTransformerFactory = (SAXTransformerFactory) SAXTransformerFactory.newInstance(); try { saxTransformerFactory.setAttribute(ACCESS_EXTERNAL_DTD, ""); } catch (IllegalArgumentException e) { UIMAFramework.getLogger().log(Level.WARNING, "SAXTransformerFactory didn't recognize setting attribute " + ACCESS_EXTERNAL_DTD); } try { saxTransformerFactory.setAttribute(ACCESS_EXTERNAL_STYLESHEET, ""); } catch (IllegalArgumentException e) { UIMAFramework.getLogger().log(Level.WARNING, "SAXTransformerFactory didn't recognize setting attribute " + ACCESS_EXTERNAL_STYLESHEET); } return saxTransformerFactory; }
_factory.setAttribute("http://xml.apache.org/xalan/features/incremental", Boolean.valueOf(incrementalProcessing)); _factory.setAttribute("http://saxon.sf.net/feature/version-warning", Boolean.FALSE);
String name = attribute.getKey(); Object value = attribute.getValue(); transformerFactory.setAttribute(name, value);
factory.setAttribute("indent-number", doctype.getIndent());
stf.setAttribute(XalanProperties.SOURCE_LOCATION, Boolean.TRUE); stf.setAttribute(org.apache.xalan.processor.TransformerFactoryImpl.FEATURE_INCREMENTAL, Boolean.TRUE);