public class WatchManager extends SequenceReceiver implements NamespaceResolver
A Watch is not itself a receiver, but it can nominate a Receiver to receive all events while it is active. It will stop receiving events when it is deactivated.
Modifier and Type | Class and Description |
---|---|
static class |
WatchManager.GroupingScope |
Modifier and Type | Field and Description |
---|---|
protected java.util.Stack<java.util.List<com.saxonica.ee.stream.watch.WatchManager.ClosedownAction>> |
activeWatchStack |
protected int |
elementStackTop |
protected java.util.List<Watch> |
watchList |
pipelineConfiguration, previousAtomic, systemId
Constructor and Description |
---|
WatchManager(PipelineConfiguration pipe)
Create a WatchManager
|
Modifier and Type | Method and Description |
---|---|
protected void |
addPrearrangedWatches() |
void |
addWatch(Watch watch,
boolean autoClose)
Add a new Watch.
|
void |
append(Item item,
Location locationId,
int copyNamespaces)
Append an arbitrary item (node or atomic value) to the output
|
void |
attribute(NodeName nameCode,
SimpleType typeCode,
java.lang.CharSequence value,
Location locationId,
int properties)
Notify an attribute
|
void |
characters(java.lang.CharSequence chars,
Location locationId,
int properties)
Text node
|
void |
close()
Notify the end of the event stream
|
void |
comment(java.lang.CharSequence chars,
Location locationId,
int properties)
Output a comment
|
void |
endDocument()
Notify the end of a document node
|
void |
endElement()
Notify end of element
|
void |
endGroupingScope(WatchManager.GroupingScope current)
Called during a partitioning for-each-group whenever a group is closed
|
int |
getDepth() |
FleetingDocumentNode |
getDocumentNode() |
MultiAccumulatorWatch |
getMultiAccumulatorWatch()
Get a map from accumulators to AccumulatorWatch instances
|
StartTagBuffer |
getStartTagBuffer() |
java.lang.String |
getURIForPrefix(java.lang.String prefix,
boolean useDefault)
Get the namespace URI corresponding to a given prefix.
|
XPathContext |
getXPathContext() |
java.util.Iterator<java.lang.String> |
iteratePrefixes()
Get an iterator over all the prefixes declared in this namespace context.
|
void |
namespace(NamespaceBindingSet namespaceBindings,
int properties)
Notify a namespace
|
void |
processingInstruction(java.lang.String target,
java.lang.CharSequence data,
Location locationId,
int properties)
Processing Instruction
|
void |
removeWatch(Watch watch)
Remove a watch
|
void |
setStartTagBuffer(StartTagBuffer stb) |
void |
setUnparsedEntity(java.lang.String name,
java.lang.String systemID,
java.lang.String publicID)
Notify an unparsed entity URI.
|
void |
setXPathContext(XPathContext context) |
void |
startCapturingGroupingWatches(WatchManager.GroupingScope scope) |
void |
startContent()
Start element content (called after all the attributes and namespaces have been processed)
|
void |
startDocument(int properties)
Start of a document node.
|
void |
startElement(NodeName elementName,
SchemaType typeCode,
Location location,
int properties)
Output element start tag
|
WatchManager.GroupingScope |
startGroupingScope()
Called during a partitioning for-each-group whenever a new group is started
|
void |
stopCapturingGroupingWatches(WatchManager.GroupingScope scope) |
boolean |
usesTypeAnnotations()
Ask whether this Receiver (or the downstream pipeline) makes any use of the type annotations
supplied on element and attribute events
|
void |
watchAccumulators(MultiAccumulatorWatch multiWatch) |
append, decompose, flatten, getConfiguration, getErrorCodeForDecomposingFunctionItems, getNamePool, getPipelineConfiguration, getSystemId, handlesAppend, open, setPipelineConfiguration, setSystemId
protected int elementStackTop
protected java.util.List<Watch> watchList
protected java.util.Stack<java.util.List<com.saxonica.ee.stream.watch.WatchManager.ClosedownAction>> activeWatchStack
public WatchManager(PipelineConfiguration pipe)
pipe
- the pipeline configurationpublic void setStartTagBuffer(StartTagBuffer stb)
public StartTagBuffer getStartTagBuffer()
public void setXPathContext(XPathContext context)
public XPathContext getXPathContext()
public void append(Item item, Location locationId, int copyNamespaces) throws XPathException
append
in interface Receiver
append
in class SequenceReceiver
item
- the item to be appendedlocationId
- the location of the calling instruction, for diagnosticscopyNamespaces
- if the item is an element node, this indicates whether its namespaces
need to be copied. Values are ReceiverOptions.ALL_NAMESPACES
,
ReceiverOptions.LOCAL_NAMESPACES
; the default (0) means
no namespacesXPathException
public void close() throws XPathException
close
in interface Receiver
XPathException
- if an error occurspublic void startDocument(int properties) throws XPathException
startDocument
in interface Receiver
properties
- bit-significant integer indicating properties of the document node.
The definitions of the bits are in class ReceiverOptions
XPathException
- if an error occurspublic void startElement(NodeName elementName, SchemaType typeCode, Location location, int properties) throws XPathException
startElement
in interface Receiver
elementName
- the name of the element.typeCode
- the type annotation of the element.location
- 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 revelant
properties, zero is supplied. The definitions of the bits are in class ReceiverOptions
XPathException
- if an error occurspublic int getDepth()
protected void addPrearrangedWatches() throws XPathException
XPathException
public void attribute(NodeName nameCode, SimpleType typeCode, java.lang.CharSequence value, Location locationId, int properties) throws XPathException
attribute
in interface Receiver
nameCode
- integer identifying the name of the attributetypeCode
- integer identifying the type annotation (ignored)value
- the value of the attributelocationId
- the location of the node in the source, or of the instruction that created itproperties
- additional properties of the attribute @throws net.sf.saxon.trans.XPathException
On any failure to write the attributeXPathException
- if an error occurspublic void namespace(NamespaceBindingSet namespaceBindings, int properties) throws XPathException
namespace
in interface Receiver
namespaceBindings
- the prefix/uri pair being notifiedproperties
- properties of this eventXPathException
- if any error occurspublic void characters(java.lang.CharSequence chars, Location locationId, int properties) throws XPathException
characters
in interface Receiver
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 void endElement() throws XPathException
endElement
in interface Receiver
XPathException
- if an error occurspublic void endDocument() throws XPathException
endDocument
in interface Receiver
XPathException
- if an error occurspublic void comment(java.lang.CharSequence chars, Location locationId, int properties) throws XPathException
comment
in interface Receiver
chars
- The content of the commentlocationId
- provides information such as line number and system ID.properties
- Additional information about the comment.XPathException
- if an error occurspublic void processingInstruction(java.lang.String target, java.lang.CharSequence data, Location locationId, int properties) throws XPathException
processingInstruction
in interface Receiver
target
- The PI name. This must be a legal name (it will not be checked).data
- The data portion of the processing instructionlocationId
- provides information such as line number and system ID.properties
- Additional information about the PI.XPathException
- if an error occurspublic void startContent() throws XPathException
startContent
in interface Receiver
XPathException
- if a failure occurspublic void setUnparsedEntity(java.lang.String name, java.lang.String systemID, java.lang.String publicID) throws XPathException
setUnparsedEntity
in interface Receiver
setUnparsedEntity
in class SequenceReceiver
name
- The name of the unparsed entitysystemID
- The system identifier of the unparsed entitypublicID
- The public identifier of the unparsed entityXPathException
- if an error occurspublic void addWatch(Watch watch, boolean autoClose) throws XPathException
watch
- the watch to be addedautoClose
- set to true if the watch is to be automatically opened as soon as it is registered,
and is to be automatically closed when it goes out of scope.XPathException
- if any error occurspublic void removeWatch(Watch watch)
watch
- the watch to be removed. No error occurs if the watch is unknown or inactive.public java.lang.String getURIForPrefix(java.lang.String prefix, boolean useDefault)
getURIForPrefix
in interface NamespaceResolver
prefix
- the namespace prefix. May be the zero-length string, indicating
that there is no prefix. This indicates either the default namespace or the
null namespace, depending on the value of useDefault.useDefault
- true if the default namespace is to be used when the
prefix is "". If false, the method returns "" when the prefix is "".public java.util.Iterator<java.lang.String> iteratePrefixes()
NamespaceResolver
iteratePrefixes
in interface NamespaceResolver
public boolean usesTypeAnnotations()
usesTypeAnnotations
in interface Receiver
public FleetingDocumentNode getDocumentNode()
public MultiAccumulatorWatch getMultiAccumulatorWatch()
public void watchAccumulators(MultiAccumulatorWatch multiWatch) throws XPathException
XPathException
public WatchManager.GroupingScope startGroupingScope()
public void endGroupingScope(WatchManager.GroupingScope current) throws XPathException
XPathException
- if a failure occurspublic void startCapturingGroupingWatches(WatchManager.GroupingScope scope)
public void stopCapturingGroupingWatches(WatchManager.GroupingScope scope)
Copyright (c) 2004-2020 Saxonica Limited. All rights reserved.