public final class XmlProcessorCreator extends Object
| Modifier and Type | Method and Description |
|---|---|
static DocumentBuilder |
createSafeDocumentBuilder(boolean namespaceAware,
boolean ignoringComments)
Creates
DocumentBuilder instance. |
static Transformer |
createSafeTransformer()
Creates
Transformer instance. |
static XMLReader |
createSafeXMLReader(boolean namespaceAware,
boolean validating)
Creates
XMLReader instance. |
static void |
setXmlParserFactory(IXmlParserFactory factory)
Specifies an
IXmlParserFactory implementation that will be used to create the xml
parsers in the XmlProcessorCreator. |
public static void setXmlParserFactory(IXmlParserFactory factory)
IXmlParserFactory implementation that will be used to create the xml
parsers in the XmlProcessorCreator. Pass DefaultSafeXmlParserFactory to use default safe
factory that should prevent XML attacks like XML bombs and XXE attacks. This will definitely
throw an exception if the XXE object is present in the XML. Also it is configured to throw
an exception even in case of any DTD in XML file, but this option depends on the parser
implementation on your system, it may not work if your parser implementation
does not support the corresponding functionality. In this case declare your own
IXmlParserFactory implementation and pass it to this method.factory - factory to be used to create xml parsers. If the passed factory is null,
the DefaultSafeXmlParserFactory will be used.public static DocumentBuilder createSafeDocumentBuilder(boolean namespaceAware, boolean ignoringComments)
DocumentBuilder instance.
The default implementation is configured to prevent
possible XML attacks (see DefaultSafeXmlParserFactory).
But you can use setXmlParserFactory(com.itextpdf.kernel.utils.IXmlParserFactory) to set your specific
factory for creating xml parsers.namespaceAware - specifies whether the parser should be namespace awareignoringComments - specifies whether the parser should ignore commentsDocumentBuilder instancepublic static XMLReader createSafeXMLReader(boolean namespaceAware, boolean validating)
XMLReader instance.
The default implementation is configured to prevent
possible XML attacks (see DefaultSafeXmlParserFactory).
But you can use setXmlParserFactory(com.itextpdf.kernel.utils.IXmlParserFactory) to set your specific
factory for creating xml parsers.namespaceAware - specifies whether the parser should be namespace awarevalidating - specifies whether the parser should validate documents as they are parsedXMLReader instancepublic static Transformer createSafeTransformer()
Transformer instance.
The default implementation is configured to prevent
possible XML attacks (see DefaultSafeXmlParserFactory).
But you can use setXmlParserFactory(com.itextpdf.kernel.utils.IXmlParserFactory) to set your specific
factory for creating xml parsers.Transformer instanceCopyright © 1998–2025 Apryse Group NV. All rights reserved.