Class StripAfterTransformer

  • All Implemented Interfaces:
    IXMLConfigurable, IImporterHandler, IDocumentTransformer

    public class StripAfterTransformer
    extends AbstractStringTransformer
    implements IXMLConfigurable

    Strips any content found after first match found for given pattern.

    This class can be used as a pre-parsing (text content-types only) or post-parsing handlers.

    XML configuration usage:

    
    <handler
        class="com.norconex.importer.handler.transformer.impl.StripAfterTransformer"
        inclusive="[false|true]"
        maxReadSize="(max characters to read at once)"
        sourceCharset="(character encoding)">
      <!-- multiple "restrictTo" tags allowed (only one needs to match) -->
      <restrictTo>
        <fieldMatcher>(field-matching expression)</fieldMatcher>
        <valueMatcher>(value-matching expression)</valueMatcher>
      </restrictTo>
      <stripAfterMatcher>
        >
             (expression matching text from which to strip)
      </stripAfterMatcher>
    </handler>

    XML usage example:

    
    <handler
        class="StripAfterTransformer"
        inclusive="true">
      <stripAfterMatcher>
        <![CDATA[<!-- FOOTER -->]]>
      </stripAfterMatcher>
    </handler>

    The above example will strip all text starting with the following HTML comment and everything after it: <!-- FOOTER -->.

    Author:
    Pascal Essiembre
    • Constructor Detail

      • StripAfterTransformer

        public StripAfterTransformer()