Class XMLTransformer


  • public final class XMLTransformer
    extends Object
    XML formatter
    • Method Detail

      • transform

        public static String transform​(@Nonnull
                                       String unformattedXML)
        This method will try to do a single pass of the input string to format it in pretty XML. For the issues observed, we are trying to avoid any expensive operations for trying to format the XMLs just for the sake of printing it in the logs. Formats the XML with default indent of 4
        Parameters:
        unformattedXML - - The raw XML with or without line breaks which needs formatting
        Returns:
        formatted XML for pretty printing
      • transform

        public static String transform​(@Nonnull
                                       String unformattedXML,
                                       int numOfSpaceForIndents)
        This method will try to do a single pass of the input string to format it in pretty XML. For the issues observed, we are trying to avoid any expensive operations for trying to format the XMLs just for the sake of printing it in the logs
        Parameters:
        unformattedXML - - The raw XML with or without line breaks which needs formatting
        numOfSpaceForIndents - - Number of space to be added for indents for pretty printing the XML
        Returns:
        formatted XML for pretty printing