Java Code Examples for javax.xml.transform.sax.SAXTransformerFactory#setFeature()
The following examples show how to use
javax.xml.transform.sax.SAXTransformerFactory#setFeature() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: FindSCU.java From weasis-dicom-tools with Eclipse Public License 2.0 | 6 votes |
private TransformerHandler getTransformerHandler() throws Exception { SAXTransformerFactory tf = saxtf; if (tf == null) { saxtf = tf = (SAXTransformerFactory) TransformerFactory.newInstance(); tf.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true); } if (xsltFile == null) { return tf.newTransformerHandler(); } Templates tpls = xsltTpls; if (tpls == null) { xsltTpls = tpls = tf.newTemplates(new StreamSource(xsltFile)); } return tf.newTransformerHandler(tpls); }
Example 2
Source File: XalanTransformerFactory.java From camel-quarkus with Apache License 2.0 | 5 votes |
public XalanTransformerFactory() { final SAXTransformerFactory factory = (SAXTransformerFactory) TransformerFactory.newInstance( "org.apache.xalan.xsltc.trax.TransformerFactoryImpl", Thread.currentThread().getContextClassLoader()); try { factory.setFeature(javax.xml.XMLConstants.FEATURE_SECURE_PROCESSING, true); } catch (TransformerException e) { LOGGER.warn("Unsupported TransformerFactory feature " + javax.xml.XMLConstants.FEATURE_SECURE_PROCESSING); } this.delegate = factory; }
Example 3
Source File: DomAnnotationParserFactory.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
AnnotationParserImpl(boolean disableSecureProcessing) { try { SAXTransformerFactory factory = stf.get(); factory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, disableSecureProcessing); transformer = factory.newTransformerHandler(); } catch (TransformerConfigurationException e) { throw new Error(e); // impossible } }
Example 4
Source File: JdkXmlUtils.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
public static SAXTransformerFactory getSAXTransformFactory(boolean overrideDefaultParser) { SAXTransformerFactory tf = overrideDefaultParser ? (SAXTransformerFactory) SAXTransformerFactory.newInstance() : (SAXTransformerFactory) new TransformerFactoryImpl(); try { tf.setFeature(OVERRIDE_PARSER, overrideDefaultParser); } catch (TransformerConfigurationException ex) { // ignore since it'd never happen with the JDK impl. } return tf; }
Example 5
Source File: DomAnnotationParserFactory.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
AnnotationParserImpl(boolean disableSecureProcessing) { try { SAXTransformerFactory factory = stf.get(); factory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, disableSecureProcessing); transformer = factory.newTransformerHandler(); } catch (TransformerConfigurationException e) { throw new Error(e); // impossible } }
Example 6
Source File: DomAnnotationParserFactory.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
AnnotationParserImpl(boolean disableSecureProcessing) { try { SAXTransformerFactory factory = stf.get(); factory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, disableSecureProcessing); transformer = factory.newTransformerHandler(); } catch (TransformerConfigurationException e) { throw new Error(e); // impossible } }
Example 7
Source File: JdkXmlUtils.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
public static SAXTransformerFactory getSAXTransformFactory(boolean overrideDefaultParser) { SAXTransformerFactory tf = overrideDefaultParser ? (SAXTransformerFactory) SAXTransformerFactory.newInstance() : (SAXTransformerFactory) new TransformerFactoryImpl(); try { tf.setFeature(OVERRIDE_PARSER, overrideDefaultParser); } catch (TransformerConfigurationException ex) { // ignore since it'd never happen with the JDK impl. } return tf; }
Example 8
Source File: DomAnnotationParserFactory.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
AnnotationParserImpl(boolean disableSecureProcessing) { try { SAXTransformerFactory factory = stf.get(); factory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, disableSecureProcessing); transformer = factory.newTransformerHandler(); } catch (TransformerConfigurationException e) { throw new Error(e); // impossible } }
Example 9
Source File: JdkXmlUtils.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
public static SAXTransformerFactory getSAXTransformFactory(boolean overrideDefaultParser) { SAXTransformerFactory tf = overrideDefaultParser ? (SAXTransformerFactory) SAXTransformerFactory.newInstance() : (SAXTransformerFactory) new TransformerFactoryImpl(); try { tf.setFeature(OVERRIDE_PARSER, overrideDefaultParser); } catch (TransformerConfigurationException ex) { // ignore since it'd never happen with the JDK impl. } return tf; }
Example 10
Source File: JdkXmlUtils.java From Bytecoder with Apache License 2.0 | 5 votes |
public static SAXTransformerFactory getSAXTransformFactory(boolean overrideDefaultParser) { SAXTransformerFactory tf = overrideDefaultParser ? (SAXTransformerFactory) SAXTransformerFactory.newInstance() : (SAXTransformerFactory) new TransformerFactoryImpl(); try { tf.setFeature(OVERRIDE_PARSER, overrideDefaultParser); } catch (TransformerConfigurationException ex) { // ignore since it'd never happen with the JDK impl. } return tf; }
Example 11
Source File: DomAnnotationParserFactory.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
AnnotationParserImpl(boolean disableSecureProcessing) { try { SAXTransformerFactory factory = stf.get(); factory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, disableSecureProcessing); transformer = factory.newTransformerHandler(); } catch (TransformerConfigurationException e) { throw new Error(e); // impossible } }
Example 12
Source File: DomAnnotationParserFactory.java From hottub with GNU General Public License v2.0 | 5 votes |
AnnotationParserImpl(boolean disableSecureProcessing) { try { SAXTransformerFactory factory = stf.get(); factory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, disableSecureProcessing); transformer = factory.newTransformerHandler(); } catch (TransformerConfigurationException e) { throw new Error(e); // impossible } }
Example 13
Source File: XSLTTransformer.java From syncope with Apache License 2.0 | 5 votes |
/** * Utility method to create a new transformer factory. * * @return a new transformer factory */ private static SAXTransformerFactory createNewSAXTransformerFactory() { SAXTransformerFactory transformerFactory = (SAXTransformerFactory) SAXTransformerFactory.newInstance(); transformerFactory.setURIResolver((href, base) -> null); try { transformerFactory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true); } catch (TransformerConfigurationException e) { LOG.error("Could not enable secure XML processing", e); } return transformerFactory; }
Example 14
Source File: TemplatesParser.java From everrest with Eclipse Public License 2.0 | 4 votes |
private SAXTransformerFactory createFeaturedSaxTransformerFactory() throws TransformerConfigurationException { SAXTransformerFactory saxTransformerFactory = (SAXTransformerFactory)SAXTransformerFactory.newInstance(); saxTransformerFactory.setFeature(FEATURE_SECURE_PROCESSING, true); return saxTransformerFactory; }