Java Code Examples for javax.xml.validation.SchemaFactory#setProperty()
The following examples show how to use
javax.xml.validation.SchemaFactory#setProperty() .
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: XmlFactory.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
public static SchemaFactory allowExternalAccess(SchemaFactory sf, String value, boolean disableSecureProcessing) { // if xml security (feature secure processing) disabled, nothing to do, no restrictions applied if (isXMLSecurityDisabled(disableSecureProcessing)) { if (LOGGER.isLoggable(Level.FINE)) { LOGGER.log(Level.FINE, Messages.JAXP_XML_SECURITY_DISABLED.format()); } return sf; } if (System.getProperty("javax.xml.accessExternalSchema") != null) { if (LOGGER.isLoggable(Level.FINE)) { LOGGER.log(Level.FINE, Messages.JAXP_EXTERNAL_ACCESS_CONFIGURED.format()); } return sf; } try { sf.setProperty(ACCESS_EXTERNAL_SCHEMA, value); if (LOGGER.isLoggable(Level.FINE)) { LOGGER.log(Level.FINE, Messages.JAXP_SUPPORTED_PROPERTY.format(ACCESS_EXTERNAL_SCHEMA)); } } catch (SAXException ignored) { // nothing to do; support depends on version JDK or SAX implementation if (LOGGER.isLoggable(Level.CONFIG)) { LOGGER.log(Level.CONFIG, Messages.JAXP_UNSUPPORTED_PROPERTY.format(ACCESS_EXTERNAL_SCHEMA), ignored); } } return sf; }
Example 2
Source File: XMLTypeValidator.java From vertx-web with Apache License 2.0 | 5 votes |
/** * Creates a SchemaFactory instance following OWASP best practices * @return SchemaFactory instance */ private static SchemaFactory createSchemaFactoryInstance() throws SAXNotRecognizedException, SAXNotSupportedException { final SchemaFactory factory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI); factory.setProperty(XMLConstants.ACCESS_EXTERNAL_DTD, ""); factory.setProperty(XMLConstants.ACCESS_EXTERNAL_SCHEMA, ""); return factory; }
Example 3
Source File: CatalogSupportBase.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
/** * Verifies Catalog Support for the Validator. * @param setUseCatalog1 a flag to indicate whether USE_CATALOG shall be set * on the factory. * @param setUseCatalog2 a flag to indicate whether USE_CATALOG shall be set * on the Validator. * @param source the XML source * @param resolver1 a resolver to be set on the factory if specified * @param resolver2 a resolver to be set on the Validator if specified * @param catalog1 a catalog to be set on the factory if specified * @param catalog2 a catalog to be set on the Validator if specified */ public void testValidator(boolean setUseCatalog1, boolean setUseCatalog2, boolean useCatalog, Source source, LSResourceResolver resolver1, LSResourceResolver resolver2, String catalog1, String catalog2) throws Exception { SchemaFactory schemaFactory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI); if (setUseCatalog1) { schemaFactory.setFeature(XMLConstants.USE_CATALOG, useCatalog); } if (catalog1 != null) { schemaFactory.setProperty(CatalogFeatures.Feature.FILES.getPropertyName(), catalog1); } if (resolver1 != null) { schemaFactory.setResourceResolver(resolver1); } Schema schema = schemaFactory.newSchema(); Validator validator = schema.newValidator(); if (setUseCatalog2) { validator.setFeature(XMLConstants.USE_CATALOG, useCatalog); } if (catalog2 != null) { validator.setProperty(CatalogFeatures.Feature.FILES.getPropertyName(), catalog2); } if (resolver2 != null) { validator.setResourceResolver(resolver2); } validator.validate(source); }
Example 4
Source File: XmlFactory.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
public static SchemaFactory allowExternalDTDAccess(SchemaFactory sf, String value, boolean disableSecureProcessing) { // if xml security (feature secure processing) disabled, nothing to do, no restrictions applied if (isXMLSecurityDisabled(disableSecureProcessing)) { if (LOGGER.isLoggable(Level.FINE)) { LOGGER.log(Level.FINE, Messages.JAXP_XML_SECURITY_DISABLED.format()); } return sf; } if (System.getProperty("javax.xml.accessExternalDTD") != null) { if (LOGGER.isLoggable(Level.FINE)) { LOGGER.log(Level.FINE, Messages.JAXP_EXTERNAL_ACCESS_CONFIGURED.format()); } return sf; } try { sf.setProperty(ACCESS_EXTERNAL_DTD, value); if (LOGGER.isLoggable(Level.FINE)) { LOGGER.log(Level.FINE, Messages.JAXP_SUPPORTED_PROPERTY.format(ACCESS_EXTERNAL_DTD)); } } catch (SAXException ignored) { // nothing to do; support depends on version JDK or SAX implementation if (LOGGER.isLoggable(Level.CONFIG)) { LOGGER.log(Level.CONFIG, Messages.JAXP_UNSUPPORTED_PROPERTY.format(ACCESS_EXTERNAL_DTD), ignored); } } return sf; }
Example 5
Source File: XmlUtil.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
public static SchemaFactory allowExternalAccess(SchemaFactory sf, String value, boolean disableSecureProcessing) { // if xml security (feature secure processing) disabled, nothing to do, no restrictions applied if (isXMLSecurityDisabled(disableSecureProcessing)) { if (LOGGER.isLoggable(Level.FINE)) { LOGGER.log(Level.FINE, "Xml Security disabled, no JAXP xsd external access configuration necessary."); } return sf; } if (System.getProperty("javax.xml.accessExternalSchema") != null) { if (LOGGER.isLoggable(Level.FINE)) { LOGGER.log(Level.FINE, "Detected explicitly JAXP configuration, no JAXP xsd external access configuration necessary."); } return sf; } try { sf.setProperty(ACCESS_EXTERNAL_SCHEMA, value); if (LOGGER.isLoggable(Level.FINE)) { LOGGER.log(Level.FINE, "Property \"{0}\" is supported and has been successfully set by used JAXP implementation.", new Object[]{ACCESS_EXTERNAL_SCHEMA}); } } catch (SAXException ignored) { // nothing to do; support depends on version JDK or SAX implementation if (LOGGER.isLoggable(Level.CONFIG)) { LOGGER.log(Level.CONFIG, "Property \"{0}\" is not supported by used JAXP implementation.", new Object[]{ACCESS_EXTERNAL_SCHEMA}); } } return sf; }
Example 6
Source File: XmlFactory.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
public static SchemaFactory allowExternalAccess(SchemaFactory sf, String value, boolean disableSecureProcessing) { // if xml security (feature secure processing) disabled, nothing to do, no restrictions applied if (isXMLSecurityDisabled(disableSecureProcessing)) { if (LOGGER.isLoggable(Level.FINE)) { LOGGER.log(Level.FINE, Messages.JAXP_XML_SECURITY_DISABLED.format()); } return sf; } if (System.getProperty("javax.xml.accessExternalSchema") != null) { if (LOGGER.isLoggable(Level.FINE)) { LOGGER.log(Level.FINE, Messages.JAXP_EXTERNAL_ACCESS_CONFIGURED.format()); } return sf; } try { sf.setProperty(ACCESS_EXTERNAL_SCHEMA, value); if (LOGGER.isLoggable(Level.FINE)) { LOGGER.log(Level.FINE, Messages.JAXP_SUPPORTED_PROPERTY.format(ACCESS_EXTERNAL_SCHEMA)); } } catch (SAXException ignored) { // nothing to do; support depends on version JDK or SAX implementation if (LOGGER.isLoggable(Level.CONFIG)) { LOGGER.log(Level.CONFIG, Messages.JAXP_UNSUPPORTED_PROPERTY.format(ACCESS_EXTERNAL_SCHEMA), ignored); } } return sf; }
Example 7
Source File: XmlUtil.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
public static SchemaFactory allowExternalAccess(SchemaFactory sf, String value, boolean disableSecureProcessing) { // if xml security (feature secure processing) disabled, nothing to do, no restrictions applied if (isXMLSecurityDisabled(disableSecureProcessing)) { if (LOGGER.isLoggable(Level.FINE)) { LOGGER.log(Level.FINE, "Xml Security disabled, no JAXP xsd external access configuration necessary."); } return sf; } if (System.getProperty("javax.xml.accessExternalSchema") != null) { if (LOGGER.isLoggable(Level.FINE)) { LOGGER.log(Level.FINE, "Detected explicitly JAXP configuration, no JAXP xsd external access configuration necessary."); } return sf; } try { sf.setProperty(ACCESS_EXTERNAL_SCHEMA, value); if (LOGGER.isLoggable(Level.FINE)) { LOGGER.log(Level.FINE, "Property \"{0}\" is supported and has been successfully set by used JAXP implementation.", new Object[]{ACCESS_EXTERNAL_SCHEMA}); } } catch (SAXException ignored) { // nothing to do; support depends on version JDK or SAX implementation if (LOGGER.isLoggable(Level.CONFIG)) { LOGGER.log(Level.CONFIG, "Property \"{0}\" is not supported by used JAXP implementation.", new Object[]{ACCESS_EXTERNAL_SCHEMA}); } } return sf; }
Example 8
Source File: XmlFactory.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
public static SchemaFactory allowExternalAccess(SchemaFactory sf, String value, boolean disableSecureProcessing) { // if xml security (feature secure processing) disabled, nothing to do, no restrictions applied if (isXMLSecurityDisabled(disableSecureProcessing)) { if (LOGGER.isLoggable(Level.FINE)) { LOGGER.log(Level.FINE, Messages.JAXP_XML_SECURITY_DISABLED.format()); } return sf; } if (System.getProperty("javax.xml.accessExternalSchema") != null) { if (LOGGER.isLoggable(Level.FINE)) { LOGGER.log(Level.FINE, Messages.JAXP_EXTERNAL_ACCESS_CONFIGURED.format()); } return sf; } try { sf.setProperty(ACCESS_EXTERNAL_SCHEMA, value); if (LOGGER.isLoggable(Level.FINE)) { LOGGER.log(Level.FINE, Messages.JAXP_SUPPORTED_PROPERTY.format(ACCESS_EXTERNAL_SCHEMA)); } } catch (SAXException ignored) { // nothing to do; support depends on version JDK or SAX implementation if (LOGGER.isLoggable(Level.CONFIG)) { LOGGER.log(Level.CONFIG, Messages.JAXP_UNSUPPORTED_PROPERTY.format(ACCESS_EXTERNAL_SCHEMA), ignored); } } return sf; }
Example 9
Source File: XmlUtil.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
public static SchemaFactory allowExternalAccess(SchemaFactory sf, String value, boolean disableSecureProcessing) { // if xml security (feature secure processing) disabled, nothing to do, no restrictions applied if (isXMLSecurityDisabled(disableSecureProcessing)) { if (LOGGER.isLoggable(Level.FINE)) { LOGGER.log(Level.FINE, "Xml Security disabled, no JAXP xsd external access configuration necessary."); } return sf; } if (System.getProperty("javax.xml.accessExternalSchema") != null) { if (LOGGER.isLoggable(Level.FINE)) { LOGGER.log(Level.FINE, "Detected explicitly JAXP configuration, no JAXP xsd external access configuration necessary."); } return sf; } try { sf.setProperty(ACCESS_EXTERNAL_SCHEMA, value); if (LOGGER.isLoggable(Level.FINE)) { LOGGER.log(Level.FINE, "Property \"{0}\" is supported and has been successfully set by used JAXP implementation.", new Object[]{ACCESS_EXTERNAL_SCHEMA}); } } catch (SAXException ignored) { // nothing to do; support depends on version JDK or SAX implementation if (LOGGER.isLoggable(Level.CONFIG)) { LOGGER.log(Level.CONFIG, "Property \"{0}\" is not supported by used JAXP implementation.", new Object[]{ACCESS_EXTERNAL_SCHEMA}); } } return sf; }
Example 10
Source File: XmlFactory.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
public static SchemaFactory allowExternalAccess(SchemaFactory sf, String value, boolean disableSecureProcessing) { // if xml security (feature secure processing) disabled, nothing to do, no restrictions applied if (isXMLSecurityDisabled(disableSecureProcessing)) { if (LOGGER.isLoggable(Level.FINE)) { LOGGER.log(Level.FINE, Messages.JAXP_XML_SECURITY_DISABLED.format()); } return sf; } if (System.getProperty("javax.xml.accessExternalSchema") != null) { if (LOGGER.isLoggable(Level.FINE)) { LOGGER.log(Level.FINE, Messages.JAXP_EXTERNAL_ACCESS_CONFIGURED.format()); } return sf; } try { sf.setProperty(ACCESS_EXTERNAL_SCHEMA, value); if (LOGGER.isLoggable(Level.FINE)) { LOGGER.log(Level.FINE, Messages.JAXP_SUPPORTED_PROPERTY.format(ACCESS_EXTERNAL_SCHEMA)); } } catch (SAXException ignored) { // nothing to do; support depends on version JDK or SAX implementation if (LOGGER.isLoggable(Level.CONFIG)) { LOGGER.log(Level.CONFIG, Messages.JAXP_UNSUPPORTED_PROPERTY.format(ACCESS_EXTERNAL_SCHEMA), ignored); } } return sf; }
Example 11
Source File: XmlFactory.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
public static SchemaFactory allowExternalDTDAccess(SchemaFactory sf, String value, boolean disableSecureProcessing) { // if xml security (feature secure processing) disabled, nothing to do, no restrictions applied if (isXMLSecurityDisabled(disableSecureProcessing)) { if (LOGGER.isLoggable(Level.FINE)) { LOGGER.log(Level.FINE, Messages.JAXP_XML_SECURITY_DISABLED.format()); } return sf; } if (System.getProperty("javax.xml.accessExternalDTD") != null) { if (LOGGER.isLoggable(Level.FINE)) { LOGGER.log(Level.FINE, Messages.JAXP_EXTERNAL_ACCESS_CONFIGURED.format()); } return sf; } try { sf.setProperty(ACCESS_EXTERNAL_DTD, value); if (LOGGER.isLoggable(Level.FINE)) { LOGGER.log(Level.FINE, Messages.JAXP_SUPPORTED_PROPERTY.format(ACCESS_EXTERNAL_DTD)); } } catch (SAXException ignored) { // nothing to do; support depends on version JDK or SAX implementation if (LOGGER.isLoggable(Level.CONFIG)) { LOGGER.log(Level.CONFIG, Messages.JAXP_UNSUPPORTED_PROPERTY.format(ACCESS_EXTERNAL_DTD), ignored); } } return sf; }
Example 12
Source File: XmlFactory.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
public static SchemaFactory allowExternalAccess(SchemaFactory sf, String value, boolean disableSecureProcessing) { // if xml security (feature secure processing) disabled, nothing to do, no restrictions applied if (isXMLSecurityDisabled(disableSecureProcessing)) { if (LOGGER.isLoggable(Level.FINE)) { LOGGER.log(Level.FINE, Messages.JAXP_XML_SECURITY_DISABLED.format()); } return sf; } if (System.getProperty("javax.xml.accessExternalSchema") != null) { if (LOGGER.isLoggable(Level.FINE)) { LOGGER.log(Level.FINE, Messages.JAXP_EXTERNAL_ACCESS_CONFIGURED.format()); } return sf; } try { sf.setProperty(ACCESS_EXTERNAL_SCHEMA, value); if (LOGGER.isLoggable(Level.FINE)) { LOGGER.log(Level.FINE, Messages.JAXP_SUPPORTED_PROPERTY.format(ACCESS_EXTERNAL_SCHEMA)); } } catch (SAXException ignored) { // nothing to do; support depends on version JDK or SAX implementation if (LOGGER.isLoggable(Level.CONFIG)) { LOGGER.log(Level.CONFIG, Messages.JAXP_UNSUPPORTED_PROPERTY.format(ACCESS_EXTERNAL_SCHEMA), ignored); } } return sf; }
Example 13
Source File: XmlUtil.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
public static SchemaFactory allowExternalAccess(SchemaFactory sf, String value, boolean disableSecureProcessing) { // if xml security (feature secure processing) disabled, nothing to do, no restrictions applied if (isXMLSecurityDisabled(disableSecureProcessing)) { if (LOGGER.isLoggable(Level.FINE)) { LOGGER.log(Level.FINE, "Xml Security disabled, no JAXP xsd external access configuration necessary."); } return sf; } if (System.getProperty("javax.xml.accessExternalSchema") != null) { if (LOGGER.isLoggable(Level.FINE)) { LOGGER.log(Level.FINE, "Detected explicitly JAXP configuration, no JAXP xsd external access configuration necessary."); } return sf; } try { sf.setProperty(ACCESS_EXTERNAL_SCHEMA, value); if (LOGGER.isLoggable(Level.FINE)) { LOGGER.log(Level.FINE, "Property \"{0}\" is supported and has been successfully set by used JAXP implementation.", new Object[]{ACCESS_EXTERNAL_SCHEMA}); } } catch (SAXException ignored) { // nothing to do; support depends on version JDK or SAX implementation if (LOGGER.isLoggable(Level.CONFIG)) { LOGGER.log(Level.CONFIG, "Property \"{0}\" is not supported by used JAXP implementation.", new Object[]{ACCESS_EXTERNAL_SCHEMA}); } } return sf; }
Example 14
Source File: XmlFactory.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
public static SchemaFactory allowExternalDTDAccess(SchemaFactory sf, String value, boolean disableSecureProcessing) { // if xml security (feature secure processing) disabled, nothing to do, no restrictions applied if (isXMLSecurityDisabled(disableSecureProcessing)) { if (LOGGER.isLoggable(Level.FINE)) { LOGGER.log(Level.FINE, Messages.JAXP_XML_SECURITY_DISABLED.format()); } return sf; } if (System.getProperty("javax.xml.accessExternalDTD") != null) { if (LOGGER.isLoggable(Level.FINE)) { LOGGER.log(Level.FINE, Messages.JAXP_EXTERNAL_ACCESS_CONFIGURED.format()); } return sf; } try { sf.setProperty(ACCESS_EXTERNAL_DTD, value); if (LOGGER.isLoggable(Level.FINE)) { LOGGER.log(Level.FINE, Messages.JAXP_SUPPORTED_PROPERTY.format(ACCESS_EXTERNAL_DTD)); } } catch (SAXException ignored) { // nothing to do; support depends on version JDK or SAX implementation if (LOGGER.isLoggable(Level.CONFIG)) { LOGGER.log(Level.CONFIG, Messages.JAXP_UNSUPPORTED_PROPERTY.format(ACCESS_EXTERNAL_DTD), ignored); } } return sf; }
Example 15
Source File: XmlFactory.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
public static SchemaFactory allowExternalAccess(SchemaFactory sf, String value, boolean disableSecureProcessing) { // if xml security (feature secure processing) disabled, nothing to do, no restrictions applied if (isXMLSecurityDisabled(disableSecureProcessing)) { if (LOGGER.isLoggable(Level.FINE)) { LOGGER.log(Level.FINE, Messages.JAXP_XML_SECURITY_DISABLED.format()); } return sf; } if (System.getProperty("javax.xml.accessExternalSchema") != null) { if (LOGGER.isLoggable(Level.FINE)) { LOGGER.log(Level.FINE, Messages.JAXP_EXTERNAL_ACCESS_CONFIGURED.format()); } return sf; } try { sf.setProperty(ACCESS_EXTERNAL_SCHEMA, value); if (LOGGER.isLoggable(Level.FINE)) { LOGGER.log(Level.FINE, Messages.JAXP_SUPPORTED_PROPERTY.format(ACCESS_EXTERNAL_SCHEMA)); } } catch (SAXException ignored) { // nothing to do; support depends on version JDK or SAX implementation if (LOGGER.isLoggable(Level.CONFIG)) { LOGGER.log(Level.CONFIG, Messages.JAXP_UNSUPPORTED_PROPERTY.format(ACCESS_EXTERNAL_SCHEMA), ignored); } } return sf; }
Example 16
Source File: XmlFactory.java From hottub with GNU General Public License v2.0 | 5 votes |
public static SchemaFactory allowExternalAccess(SchemaFactory sf, String value, boolean disableSecureProcessing) { // if xml security (feature secure processing) disabled, nothing to do, no restrictions applied if (isXMLSecurityDisabled(disableSecureProcessing)) { if (LOGGER.isLoggable(Level.FINE)) { LOGGER.log(Level.FINE, Messages.JAXP_XML_SECURITY_DISABLED.format()); } return sf; } if (System.getProperty("javax.xml.accessExternalSchema") != null) { if (LOGGER.isLoggable(Level.FINE)) { LOGGER.log(Level.FINE, Messages.JAXP_EXTERNAL_ACCESS_CONFIGURED.format()); } return sf; } try { sf.setProperty(ACCESS_EXTERNAL_SCHEMA, value); if (LOGGER.isLoggable(Level.FINE)) { LOGGER.log(Level.FINE, Messages.JAXP_SUPPORTED_PROPERTY.format(ACCESS_EXTERNAL_SCHEMA)); } } catch (SAXException ignored) { // nothing to do; support depends on version JDK or SAX implementation if (LOGGER.isLoggable(Level.CONFIG)) { LOGGER.log(Level.CONFIG, Messages.JAXP_UNSUPPORTED_PROPERTY.format(ACCESS_EXTERNAL_SCHEMA), ignored); } } return sf; }
Example 17
Source File: XmlFactory.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
public static SchemaFactory allowExternalAccess(SchemaFactory sf, String value, boolean disableSecureProcessing) { // if xml security (feature secure processing) disabled, nothing to do, no restrictions applied if (isXMLSecurityDisabled(disableSecureProcessing)) { if (LOGGER.isLoggable(Level.FINE)) { LOGGER.log(Level.FINE, Messages.JAXP_XML_SECURITY_DISABLED.format()); } return sf; } if (System.getProperty("javax.xml.accessExternalSchema") != null) { if (LOGGER.isLoggable(Level.FINE)) { LOGGER.log(Level.FINE, Messages.JAXP_EXTERNAL_ACCESS_CONFIGURED.format()); } return sf; } try { sf.setProperty(ACCESS_EXTERNAL_SCHEMA, value); if (LOGGER.isLoggable(Level.FINE)) { LOGGER.log(Level.FINE, Messages.JAXP_SUPPORTED_PROPERTY.format(ACCESS_EXTERNAL_SCHEMA)); } } catch (SAXException ignored) { // nothing to do; support depends on version JDK or SAX implementation if (LOGGER.isLoggable(Level.CONFIG)) { LOGGER.log(Level.CONFIG, Messages.JAXP_UNSUPPORTED_PROPERTY.format(ACCESS_EXTERNAL_SCHEMA), ignored); } } return sf; }
Example 18
Source File: SchemaFactoryBuilder.java From dss with GNU Lesser General Public License v2.1 | 4 votes |
@Override protected void setSecurityAttribute(SchemaFactory factory, String attribute, Object value) throws Exception { factory.setProperty(attribute, value); }
Example 19
Source File: SchemaFactoryTest.java From openjdk-jdk9 with GNU General Public License v2.0 | 4 votes |
@Test(expectedExceptions = NullPointerException.class) public void testSetNullProperty() throws SAXNotRecognizedException, SAXNotSupportedException { SchemaFactory sf = newSchemaFactory(); assertNotNull(sf); sf.setProperty(null, "test"); }
Example 20
Source File: XmlUtils.java From tracecompass with Eclipse Public License 2.0 | 3 votes |
/** * Get a safe {@link SchemaFactory} * * @return a safe {@link SchemaFactory} * @throws SAXException * parse exception with * {@link XMLConstants#W3C_XML_SCHEMA_NS_URI} * @since 4.2 */ public static SchemaFactory newSafeSchemaFactory() throws SAXException { SchemaFactory factory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI); factory.setProperty(XMLConstants.ACCESS_EXTERNAL_DTD, EMPTY); factory.setProperty(XMLConstants.ACCESS_EXTERNAL_SCHEMA, EMPTY); return factory; }