Package net.sf.saxon.s9api

## Class WhitespaceStrippingPolicy

- java.lang.Object
- - net.sf.saxon.s9api.WhitespaceStrippingPolicy

-     public class WhitespaceStrippingPolicy
      extends java.lang.Object

  WhitespaceStrippingPolicy is class defining the possible policies for handling whitespace text nodes in a source document.

- - ### Field Summary

    Fields
    Modifier and Type | Field | Description
    --- | --- | ---
    `static WhitespaceStrippingPolicy` | `ALL` | The value ALL indicates that all whitespace-only text nodes are discarded.
    `static WhitespaceStrippingPolicy` | `IGNORABLE` | The value IGNORABLE indicates that whitespace text nodes in element-only content are discarded.
    `static WhitespaceStrippingPolicy` | `NONE` | The value NONE indicates that all whitespace text nodes are retained.
    `static WhitespaceStrippingPolicy` | `UNSPECIFIED` | UNSPECIFIED means that no other value has been specifically requested.

  - ### Constructor Summary

    Constructors
    Modifier | Constructor | Description
    --- | --- | ---
    `protected` | `WhitespaceStrippingPolicy​(StylesheetPackage pack)` | Create a WhitespaceStrippingPolicy based on the xsl:strip-space and xsl:preserve-space declarations in a given XSLT stylesheet package

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `protected SpaceStrippingRule` | `getSpaceStrippingRule()` |
    `static WhitespaceStrippingPolicy` | `makeCustomPolicy​(java.util.function.Predicate<QName> elementTest)` | Create a custom whitespace stripping policy, by supplying a predicate that indicates for any given element, whether whitespace text nodes among its children should be stripped or preserved.
    `protected FilterFactory` | `makeStripper()` |
    `protected int` | `ordinal()` |

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### NONE

          public static final WhitespaceStrippingPolicy NONE

      The value NONE indicates that all whitespace text nodes are retained. This is the default when documents are processed without validation.

    - #### IGNORABLE

          public static final WhitespaceStrippingPolicy IGNORABLE

      The value IGNORABLE indicates that whitespace text nodes in element-only content are discarded. Content is element-only if it is defined by a schema or DTD definition that does not allow mixed or PCDATA content. This option is in effect documentary only, since this policy is always used when DTD or schema validation is selected for a `DocumentBuilder`, and is equivalent to `NONE` otherwise.

    - #### ALL

          public static final WhitespaceStrippingPolicy ALL

      The value ALL indicates that all whitespace-only text nodes are discarded.

    - #### UNSPECIFIED

          public static final WhitespaceStrippingPolicy UNSPECIFIED

      UNSPECIFIED means that no other value has been specifically requested.

  - ### Constructor Detail

    - #### WhitespaceStrippingPolicy

          protected WhitespaceStrippingPolicy​(StylesheetPackage pack)

      Create a WhitespaceStrippingPolicy based on the xsl:strip-space and xsl:preserve-space declarations in a given XSLT stylesheet package
      Parameters:
        `pack` - the stylesheet package containing the xsl:strip-space and xsl:preserve-space declarations

  - ### Method Detail

    - #### makeCustomPolicy

          public static WhitespaceStrippingPolicy makeCustomPolicy​(java.util.function.Predicate<QName> elementTest)

      Create a custom whitespace stripping policy, by supplying a predicate that indicates for any given element, whether whitespace text nodes among its children should be stripped or preserved. Note that xml:space attributes that might be present have no effect on the outcome, and the decision applies only to immediate children, not to descendants.

      Changed in 9.9 to use the standard Java 8 Predicate class in place of Saxon's version.

      Parameters:
        `elementTest` - a predicate applied to element names, which should return true if whitespace-only text node children of the element are to be stripped, false if they are to be retained.

    - #### ordinal

          protected int ordinal()

    - #### getSpaceStrippingRule

          protected SpaceStrippingRule getSpaceStrippingRule()

    - #### makeStripper

          protected FilterFactory makeStripper()