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 |
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
|
FleetingParentNode |
getCurrentNode() |
int |
getDepth() |
FleetingDocumentNode |
getDocumentNode() |
MultiAccumulatorWatch |
getMultiAccumulatorWatch() |
Outputter |
getOutputter() |
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 |
processingInstruction(java.lang.String target,
java.lang.CharSequence data,
Location locationId,
int properties)
Processing Instruction
|
void |
removeWatch(Watch watch)
Remove a watch
|
void |
restartElement(Watch watch)
During schema validation, the startElement() event is emitted before we can
examine all the streamed assertions that might apply to that element.
|
void |
setOutputter(Outputter outputter) |
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 |
startDocument(int properties)
Start of a document node.
|
void |
startElement(NodeName elementName,
SchemaType typeCode,
AttributeMap attributes,
NamespaceMap namespaces,
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 setXPathContext(XPathContext context)
public XPathContext getXPathContext()
public void setOutputter(Outputter outputter)
public Outputter getOutputter()
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 ReceiverOption.ALL_NAMESPACES
;
the default (0) meansXPathException
- if an error occurspublic void close() throws XPathException
close
in interface Receiver
XPathException
- if an error occurspublic void startDocument(int properties) throws XPathException
startDocument
in interface Receiver
properties
- XPathException
- if an error occurspublic void startElement(NodeName elementName, SchemaType typeCode, AttributeMap attributes, NamespaceMap namespaces, Location location, int properties) throws XPathException
startElement
in interface Receiver
elementName
- the name of the element.typeCode
- 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 restartElement(Watch watch) throws XPathException
XPathException
public int getDepth()
public FleetingParentNode getCurrentNode()
protected void addPrearrangedWatches() throws XPathException
XPathException
public 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 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.