public class Stripper extends ProxyReceiver
Stripper
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.
If you found this code as a result of a Google search, sorry about the disappointment.
Modifier and Type | Class and Description |
---|---|
static class |
Stripper.StripRuleTarget |
Modifier and Type | Field and Description |
---|---|
static int |
ALWAYS_PRESERVE |
static int |
ALWAYS_STRIP |
static int |
ASSERTIONS_EXIST |
static Stripper.StripRuleTarget |
PRESERVE |
static int |
PRESERVE_PARENT |
protected SpaceStrippingRule |
rule |
static int |
SIMPLE_CONTENT |
static Stripper.StripRuleTarget |
STRIP |
static int |
STRIP_DEFAULT |
nextReceiver
pipelineConfiguration, previousAtomic, systemId
Constructor and Description |
---|
Stripper(SpaceStrippingRule rule,
Receiver next) |
Modifier and Type | Method and Description |
---|---|
void |
characters(UnicodeString chars,
Location locationId,
int properties)
Handle a text node
|
void |
endElement()
Handle an end-of-element event
|
void |
open()
Callback interface for SAX: not for application use
|
void |
startElement(NodeName elemName,
SchemaType type,
AttributeMap attributes,
NamespaceMap namespaces,
Location location,
int properties)
Notify the start of an element
|
boolean |
usesTypeAnnotations()
Ask whether this Receiver (or the downstream pipeline) makes any use of the type annotations
supplied on element and attribute events
|
append, close, comment, endDocument, getNamePool, getNextReceiver, processingInstruction, setPipelineConfiguration, setSystemId, setUnderlyingReceiver, setUnparsedEntity, startDocument
append, decompose, flatten, getConfiguration, getErrorCodeForDecomposingFunctionItems, getPipelineConfiguration, getSystemId, handlesAppend
public static final Stripper.StripRuleTarget STRIP
public static final Stripper.StripRuleTarget PRESERVE
protected SpaceStrippingRule rule
public static final int ALWAYS_PRESERVE
public static final int ALWAYS_STRIP
public static final int STRIP_DEFAULT
public static final int PRESERVE_PARENT
public static final int SIMPLE_CONTENT
public static final int ASSERTIONS_EXIST
public Stripper(SpaceStrippingRule rule, Receiver next)
public void open() throws XPathException
open
in interface Receiver
open
in class ProxyReceiver
XPathException
- if an error occurspublic void startElement(NodeName elemName, SchemaType type, AttributeMap attributes, NamespaceMap namespaces, Location location, int properties) throws XPathException
ProxyReceiver
startElement
in interface Receiver
startElement
in class ProxyReceiver
elemName
- the name of the element.type
- the type annotation of the element.attributes
- the attributes of this elementnamespaces
- the in-scope namespaces of this element: generally this is all the in-scope
namespaces, without relying on inheriting namespaces from parent elementslocation
- an object providing information about the module, line, and column where the node originatedproperties
- bit-significant properties of the element node. If there are no relevant
properties, zero is supplied. The definitions of the bits are in class ReceiverOption
XPathException
- if an error occurspublic void endElement() throws XPathException
endElement
in interface Receiver
endElement
in class ProxyReceiver
XPathException
- if an error occurspublic void characters(UnicodeString chars, Location locationId, int properties) throws XPathException
characters
in interface Receiver
characters
in class ProxyReceiver
chars
- The characterslocationId
- provides information such as line number and system ID.properties
- Bit significant value. The following bits are defined:
XPathException
- if an error occurspublic boolean usesTypeAnnotations()
usesTypeAnnotations
in interface Receiver
usesTypeAnnotations
in class ProxyReceiver
Copyright (c) 2004-2022 Saxonica Limited. All rights reserved.