Saxon.Api

 

 

Saxon.Api

Class WhitespacePolicy


public class WhitespacePolicy

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

Please note that since Saxon 9.7.0.8 this class has been refactored from the enumeration type with the same name and therefore will work as before.

Field Summary

static WhitespacePolicy PreserveAll

No whitespace is stripped

static WhitespacePolicy StripAll

All whitespace text nodes are stripped

static WhitespacePolicy StripIgnorable

Whitespace text nodes appearing in element-only content are stripped

static WhitespacePolicy Unspecified

Unspecified means that no other value has been specifically requested

 

Method Summary

static WhitespacePolicy makeCustomPolicy(Predicate<QName> elementTest)

Deprecated This method has been replaced by MakeCustomPolicy.

static WhitespacePolicy MakeCustomPolicy(Predicate<QName> elementTest)

Create a custom whitespace stripping policy

 

Field Detail

PreserveAll

public static WhitespacePolicy PreserveAll

No whitespace is stripped

StripAll

public static WhitespacePolicy StripAll

All whitespace text nodes are stripped

StripIgnorable

public static WhitespacePolicy StripIgnorable

Whitespace text nodes appearing in element-only content are stripped

Unspecified

public static WhitespacePolicy Unspecified

Unspecified means that no other value has been specifically requested

Method Detail

makeCustomPolicy

public static WhitespacePolicy makeCustomPolicy(Predicate<QName> elementTest)

Deprecated This method has been replaced by MakeCustomPolicy.

Create a custom whitespace stripping policy

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.

Returns:

A WhitespacePolicy object

MakeCustomPolicy

public static WhitespacePolicy MakeCustomPolicy(Predicate<QName> elementTest)

Create a custom whitespace stripping policy

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.

Returns:

A WhitespacePolicy object