List of usage examples for javax.xml.transform.stream StreamResult FEATURE
String FEATURE
To view the source code for javax.xml.transform.stream StreamResult FEATURE.
Click Source Link
From source file:net.sf.joost.trax.TransformerFactoryImpl.java
/** * Supplied features.//from ww w . j a v a 2 s . c o m * @param name Name of the feature. * @return true if feature is supported. */ public boolean getFeature(String name) { if (name.equals(SAXSource.FEATURE)) { return true; } if (name.equals(SAXResult.FEATURE)) { return true; } if (name.equals(DOMSource.FEATURE)) { return true; } if (name.equals(DOMResult.FEATURE)) { return true; } if (name.equals(StreamSource.FEATURE)) { return true; } if (name.equals(StreamResult.FEATURE)) { return true; } if (name.equals(SAXTransformerFactory.FEATURE)) { return true; } if (name.equals(SAXTransformerFactory.FEATURE_XMLFILTER)) { return true; } String errMsg = "Unknown feature " + name; TransformerConfigurationException tE = new TransformerConfigurationException(errMsg); try { defaultErrorListener.error(tE); return false; } catch (TransformerException e) { throw new IllegalArgumentException(errMsg); } }
From source file:org.eclipse.smila.search.servlet.SMILASearchServlet.java
/** * create XSL transformer for stylesheet. * * @param xslDoc/* w ww .j a v a2s. co m*/ * XSL DOM document * @return XSL transformer * @throws ServletException * error. */ protected Transformer getXSLTransformer(final Document xslDoc) throws ServletException { final TransformerFactory tFactory = TransformerFactory.newInstance(); if (tFactory.getFeature(DOMSource.FEATURE) && tFactory.getFeature(StreamResult.FEATURE)) { final DOMSource xslDomSource = new DOMSource(xslDoc); try { return tFactory.newTransformer(xslDomSource); } catch (final TransformerConfigurationException e) { throw new ServletException("error while creating the transformer", e); } } else { throw new ServletException("the transformer [" + tFactory.getClass().getName() + "] doesn't support the used DOMSource or StreamResult"); } }