Package com.atlassian.security.xml
Class SecureXmlParserFactory
java.lang.Object
com.atlassian.security.xml.SecureXmlParserFactory
Utility methods to produce parsers suitable for untrusted XML.
These cover the core parsing APIs included in JDK 1.6.
Parsers will have FEATURE_SECURE_PROCESSING enabled and be configured to ignore external resources used for, or in, DTDs.
- Since:
- 3.0
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic SAXParserFactoryCreate a new SAXSAXParserFactorysuitable for parsing XML from an untrusted sourcestatic EntityResolverCreate a newEntityResolverthat will resolve every entity to an empty stream, rather than fetching resources from the network.static DocumentBuilderCreate a new DOMDocumentBuildersuitable for parsing XML from an untrusted source.static DocumentBuilderFactorystatic DocumentBuilderCreate a new namespace-aware DOMDocumentBuildersuitable for parsing XML from an untrusted source.static XMLReaderCreate a new namespace-aware SAXXMLReadersuitable for parsing XML from an untrusted source.static XMLInputFactoryCreate a new StAXXMLInputFactorysuitable for parsing XML from an untrusted source.static XMLReaderCreate a new SAXXMLReadersuitable for parsing XML from an untrusted source.
-
Field Details
-
ATTRIBUTE_LOAD_EXTERNAL
- See Also:
-
FEATURE_EXTERNAL_GENERAL_ENTITIES
- See Also:
-
FEATURE_EXTERNAL_PARAMETER_ENTITIES
- See Also:
-
-
Method Details
-
newDocumentBuilderFactory
- Returns:
- A locked-down DocumentBuilderFactory
- Since:
- 3.1.2
-
newDocumentBuilder
Create a new DOMDocumentBuildersuitable for parsing XML from an untrusted source.- Returns:
- a new parser
-
createSAXParserFactory
public static SAXParserFactory createSAXParserFactory() throws SAXException, ParserConfigurationExceptionCreate a new SAXSAXParserFactorysuitable for parsing XML from an untrusted source- Returns:
- a new
SAXParserFactory - Throws:
SAXExceptionParserConfigurationException
-
newXmlReader
Create a new SAXXMLReadersuitable for parsing XML from an untrusted source.- Returns:
- a new parser
-
newNamespaceAwareXmlReader
Create a new namespace-aware SAXXMLReadersuitable for parsing XML from an untrusted source.- Returns:
- a new parser
-
newNamespaceAwareDocumentBuilder
Create a new namespace-aware DOMDocumentBuildersuitable for parsing XML from an untrusted source.- Returns:
- a new parser
-
newXmlInputFactory
Create a new StAXXMLInputFactorysuitable for parsing XML from an untrusted source.- Returns:
- a new parser
-
emptyEntityResolver
Create a newEntityResolverthat will resolve every entity to an empty stream, rather than fetching resources from the network.
-