Class WhitespaceStrippedSource

  • All Implemented Interfaces:
    Source

    public class WhitespaceStrippedSource
    extends DOMSource
    A source that is obtained from a different source by removing all empty text nodes and trimming the non-empty ones.

    If you only want to remove text nodes consisting solely of whitespace (AKA element content whitespace) but leave all other text nodes alone you should use ElementContentWhitespaceStrippedSource instead.

    • Constructor Detail

      • WhitespaceStrippedSource

        public WhitespaceStrippedSource​(Source originalSource)
        Creates a new source that consists of the given source with all empty text nodes removed and all non-empty text nodes trimmed.
        Parameters:
        originalSource - the original source
      • WhitespaceStrippedSource

        public WhitespaceStrippedSource​(Source originalSource,
                                        DocumentBuilderFactory dbf)
        Creates a new source that consists of the given source with all empty text nodes removed and all non-empty text nodes trimmed.
        Parameters:
        originalSource - the original source
        dbf - the DocumentBuilderFactory to use when creating a DOM document from originalSource