net.sf.saxon.event
Class RuleBasedStripper
java.lang.Object
net.sf.saxon.event.SequenceReceiver
net.sf.saxon.event.ProxyReceiver
net.sf.saxon.event.Stripper
net.sf.saxon.event.RuleBasedStripper
- All Implemented Interfaces:
- Result, Receiver
public class RuleBasedStripper
- extends Stripper
The RuleBasedStripper class performs whitespace stripping according to the rules of
the xsl:strip-space and xsl:preserve-space instructions.
It maintains details of which elements need to be stripped.
The code is written to act as a SAX-like filter to do the stripping.
- Author:
- Michael H. Kay
Methods inherited from class net.sf.saxon.event.ProxyReceiver |
append, close, comment, endDocument, getConfiguration, getDocumentLocator, getNamePool, getUnderlyingReceiver, namespace, processingInstruction, setPipelineConfiguration, setSystemId, setUnderlyingReceiver, setUnparsedEntity, startContent, startDocument |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
STRIP
public static final RuleBasedStripper.StripRuleTarget STRIP
PRESERVE
public static final RuleBasedStripper.StripRuleTarget PRESERVE
RuleBasedStripper
public RuleBasedStripper()
- Default constructor for use in subclasses
RuleBasedStripper
public RuleBasedStripper(StripSpaceRules stripperRules)
- create a Stripper and initialise variables
- Parameters:
stripperRules
- defines which elements have whitespace stripped. If
null, all whitespace is preserved.
getAnother
public RuleBasedStripper getAnother()
- Get a clean copy of this stripper. The new copy shares the same PipelineConfiguration
as the original, but the underlying receiver (that is, the destination for post-stripping
events) is left uninitialized.
- Specified by:
getAnother
in class Stripper
isSpacePreserving
public byte isSpacePreserving(int fingerprint)
throws XPathException
- Decide whether an element is in the set of white-space preserving element names
- Specified by:
isSpacePreserving
in class Stripper
- Parameters:
fingerprint
- Identifies the name of the element whose whitespace is to
be preserved
- Returns:
- ALWAYS_PRESERVE if the element is in the set of white-space preserving
element types, ALWAYS_STRIP if the element is to be stripped regardless of the
xml:space setting, and STRIP_DEFAULT otherwise
- Throws:
XPathException
- if the rules are ambiguous and ambiguities are to be
reported as errors
Copyright (c) 2004-2010 Saxonica Limited. All rights reserved.