Class XMLTransformerFactory


  • @Immutable
    public final class XMLTransformerFactory
    extends Object
    A global factory for XML transformation objects.
    Author:
    Philip Helger
    • Method Detail

      • makeTransformerFactorySecure

        public static void makeTransformerFactorySecure​(@Nonnull
                                                        TransformerFactory aFactory,
                                                        @Nullable
                                                        String... aAllowedExternalSchemes)
        Set the secure processing feature to a TransformerFactory. See https://docs.oracle.com/javase/tutorial/jaxp/properties/properties.html for details.
        Parameters:
        aFactory - The factory to secure. May not be null.
        aAllowedExternalSchemes - Optional external URL schemes that are allowed to be accessed (as in "file" or "http")
        Since:
        9.1.2
      • getDefaultTransformerFactory

        @Nonnull
        public static TransformerFactory getDefaultTransformerFactory()
        Returns:
        The default transformer factory.
      • newTransformer

        @Nullable
        public static Transformer newTransformer()
        Create a new XSLT transformer for no specific resource. This uses the central not thread safe transformer factory.
        Returns:
        null if something goes wrong
      • newTransformer

        @Nullable
        public static Transformer newTransformer​(@Nonnull
                                                 TransformerFactory aTransformerFactory)
        Create a new XSLT transformer for no specific resource.
        Parameters:
        aTransformerFactory - The transformer factory to be used. May not be null.
        Returns:
        null if something goes wrong
      • newTransformer

        @Nullable
        public static Transformer newTransformer​(@Nonnull
                                                 com.helger.commons.io.resource.IReadableResource aResource)
        Create a new XSLT transformer for the passed resource. This uses the central not thread safe transformer factory.
        Parameters:
        aResource - The resource to be transformed. May not be null.
        Returns:
        null if something goes wrong
      • newTransformer

        @Nullable
        public static Transformer newTransformer​(@Nonnull
                                                 TransformerFactory aTransformerFactory,
                                                 @Nonnull
                                                 com.helger.commons.io.resource.IReadableResource aResource)
        Create a new XSLT transformer for the passed resource.
        Parameters:
        aTransformerFactory - The transformer factory to be used. May not be null.
        aResource - The resource to be transformed. May not be null.
        Returns:
        null if something goes wrong
      • newTransformer

        @Nullable
        public static Transformer newTransformer​(@Nonnull
                                                 Source aSource)
        Create a new XSLT transformer for the passed resource. This uses the central not thread safe transformer factory.
        Parameters:
        aSource - The resource to be transformed. May not be null.
        Returns:
        null if something goes wrong
      • newTransformer

        @Nullable
        public static Transformer newTransformer​(@Nonnull
                                                 TransformerFactory aTransformerFactory,
                                                 @Nonnull
                                                 Source aSource)
        Create a new XSLT transformer for the passed resource.
        Parameters:
        aTransformerFactory - The transformer factory to be used. May not be null.
        aSource - The resource to be transformed. May not be null.
        Returns:
        null if something goes wrong
      • newTemplates

        @Nullable
        public static Templates newTemplates​(@Nonnull
                                             com.helger.commons.io.resource.IReadableResource aResource)
        Create a new XSLT Template for the passed resource. This uses the central not thread safe transformer factory.
        Parameters:
        aResource - The resource to be templated. May not be null.
        Returns:
        null if something goes wrong
      • newTemplates

        @Nullable
        public static Templates newTemplates​(@Nonnull
                                             Source aSource)
        Create a new XSLT Template for the passed resource. This uses the central not thread safe transformer factory.
        Parameters:
        aSource - The resource to be templated. May not be null.
        Returns:
        null if something goes wrong
      • newTemplates

        @Nullable
        public static Templates newTemplates​(@Nonnull
                                             TransformerFactory aFactory,
                                             @Nonnull
                                             com.helger.commons.io.resource.IReadableResource aResource)
        Create a new XSLT Template for the passed resource.
        Parameters:
        aFactory - The transformer factory to be used. May not be null.
        aResource - The resource to be templated. May not be null.
        Returns:
        null if something goes wrong
      • newTemplates

        @Nullable
        public static Templates newTemplates​(@Nonnull
                                             TransformerFactory aTransformerFactory,
                                             @Nonnull
                                             Source aSource)
        Create a new XSLT Template for the passed resource.
        Parameters:
        aTransformerFactory - The transformer factory to be used. May not be null.
        aSource - The resource to be templated. May not be null.
        Returns:
        null if something goes wrong