Package overit.geocall.xml
Class SecureXml
java.lang.Object
overit.geocall.xml.SecureXml
-
Method Summary
Modifier and TypeMethodDescriptionstatic DocumentBuilderFactoryCreate a new DocumentBuilderFactory instance, enabling the attributes in order to prevent: the access to external DTD the access to external schema the unsafe document processingstatic SAXParserFactoryCreate a new SAXParserFactory instance, enabling the attributes in order to prevent: the access to external DTD the access to external schema the unsafe document processingstatic SchemaFactorynewSchemaFactory(String schemaLanguage) Create a new SchemaFactory instance, enabling the attributes in order to prevent: the access to external DTD the access to external schema the unsafe document processingstatic TransformerFactoryCreate a new TransformerFactory instance, enabling the attributes in order to prevent: the access to external DTD the access to external stylesheet the unsafe document processingstatic booleansecure(DocumentBuilderFactory factory, String accessExternalDtd, String accessExternalSchema, String accessExternalStylesheet) Secures the DocumentBuilderFactory, by preventing the the access to external DTD the access to external schema the access to external stylesheetstatic booleansecure(SAXParser parser, String accessExternalDtd, String accessExternalSchema, String accessExternalStylesheet) Secures the SAXParser, by preventing the the access to external DTD the access to external schema the access to external stylesheetstatic booleansecure(TransformerFactory factory, String accessExternalDtd, String accessExternalSchema, String accessExternalStylesheet) Secures the TransformerFactory, by preventing the the access to external DTD the access to external schema the access to external stylesheetstatic booleansecure(SchemaFactory factory, String accessExternalDtd, String accessExternalSchema, String accessExternalStylesheet) Secures the SchemaFactory, by preventing the the access to external DTD the access to external schema the access to external stylesheet
-
Method Details
-
newDocumentBuilderFactory
public static DocumentBuilderFactory newDocumentBuilderFactory() throws ParserConfigurationExceptionCreate a new DocumentBuilderFactory instance, enabling the attributes in order to prevent:- the access to external DTD
- the access to external schema
- the unsafe document processing
- Returns:
- New instance of a DocumentBuilderFactory
- Throws:
ParserConfigurationException- if this DocumentBuilderFactory or the DocumentBuilders it creates cannot support theXMLConstants.FEATURE_SECURE_PROCESSINGfeature.
-
newTransformerFactory
Create a new TransformerFactory instance, enabling the attributes in order to prevent:- the access to external DTD
- the access to external stylesheet
- the unsafe document processing
- Returns:
- New instance of a TransformerFactory
- Throws:
TransformerConfigurationException- if this TransformerFactory or the Transformers or Templates it creates cannot support theXMLConstants.FEATURE_SECURE_PROCESSINGfeature.
-
newSchemaFactory
public static SchemaFactory newSchemaFactory(String schemaLanguage) throws SAXNotRecognizedException, SAXNotSupportedException Create a new SchemaFactory instance, enabling the attributes in order to prevent:- the access to external DTD
- the access to external schema
- the unsafe document processing
- Parameters:
schemaLanguage- Specifies the schema language which the returned SchemaFactory will understand. The same as inSchemaFactory.newInstance(java.lang.String)- Returns:
- New instance of a SchemaFactory
- Throws:
SAXNotRecognizedException- If the feature value can't be assigned or retrieved.SAXNotSupportedException- If the feature value can't be assigned or retrieved.
-
newSAXParserFactory
public static SAXParserFactory newSAXParserFactory() throws SAXException, ParserConfigurationExceptionCreate a new SAXParserFactory instance, enabling the attributes in order to prevent:- the access to external DTD
- the access to external schema
- the unsafe document processing
- Returns:
- New instance of a SAXParserFactory.
- Throws:
ParserConfigurationException- if this SAXParserFactory cannot support theXMLConstants.FEATURE_SECURE_PROCESSINGfeature.SAXNotRecognizedException- If the feature value can't be assigned or retrieved.SAXException
-
secure
public static boolean secure(DocumentBuilderFactory factory, String accessExternalDtd, String accessExternalSchema, String accessExternalStylesheet) Secures the DocumentBuilderFactory, by preventing the- the access to external DTD
- the access to external schema
- the access to external stylesheet
- Parameters:
factory- the DocumentBuilderFactory's instanceaccessExternalDtd-trueto prevent the access to external DTDaccessExternalSchema-trueto prevent the access to external schemaaccessExternalStylesheet-trueto prevent the access to external stylesheet- Returns:
trueif the configuration has been succeed;falseotherwise,
-
secure
public static boolean secure(TransformerFactory factory, String accessExternalDtd, String accessExternalSchema, String accessExternalStylesheet) Secures the TransformerFactory, by preventing the- the access to external DTD
- the access to external schema
- the access to external stylesheet
- Parameters:
factory- the TransformerFactory's instanceaccessExternalDtd-trueto prevent the access to external DTDaccessExternalSchema-trueto prevent the access to external schemaaccessExternalStylesheet-trueto prevent the access to external stylesheet- Returns:
trueif the configuration has been succeed;falseotherwise,
-
secure
public static boolean secure(SchemaFactory factory, String accessExternalDtd, String accessExternalSchema, String accessExternalStylesheet) throws SAXNotRecognizedException, SAXNotSupportedException Secures the SchemaFactory, by preventing the- the access to external DTD
- the access to external schema
- the access to external stylesheet
- Parameters:
factory- the SchemaFactory's instanceaccessExternalDtd-trueto prevent the access to external DTDaccessExternalSchema-trueto prevent the access to external schemaaccessExternalStylesheet-trueto prevent the access to external stylesheet- Returns:
trueif the configuration has been succeed;falseotherwise,- Throws:
SAXNotRecognizedException- If the property value can't be assigned or retrieved.SAXNotSupportedException- When the SchemaFactory recognizes the property name but cannot set the requested value.
-
secure
public static boolean secure(SAXParser parser, String accessExternalDtd, String accessExternalSchema, String accessExternalStylesheet) throws SAXNotRecognizedException, SAXNotSupportedException Secures the SAXParser, by preventing the- the access to external DTD
- the access to external schema
- the access to external stylesheet
- Parameters:
parser- the SAXParser's instanceaccessExternalDtd-trueto prevent the access to external DTDaccessExternalSchema-trueto prevent the access to external schemaaccessExternalStylesheet-trueto prevent the access to external stylesheet- Returns:
trueif the configuration has been succeed;falseotherwise- Throws:
SAXNotRecognizedException- When the underlying XMLReader does not recognize the property name.SAXNotSupportedException- When the underlying XMLReader recognizes the property name but doesn't support the property.
-