Package net.sf.saxon.evpull
Class NamespaceMaintainer
java.lang.Object
net.sf.saxon.evpull.NamespaceMaintainer
- All Implemented Interfaces:
EventIterator
,PullEvent
,NamespaceResolver
NamespaceMaintainer is an EventIterator responsible for maintaining namespace context in an
event stream. It allows the current namespace context to be determined at any time while
processing the stream of events.
Note that this class merely provides the service of keeping track of which namespaces are currently in scope. It does not attempt to remove duplicate namespace declarations, and it does not perform namespace fixup.
-
Constructor Summary
ConstructorsConstructorDescriptionCreate a namespace context for a pull-events pipeline -
Method Summary
Modifier and TypeMethodDescriptiongetURIForPrefix
(String prefix, boolean useDefault) Get the namespace URI corresponding to a given prefix.boolean
Determine whether the EventIterator returns a flat sequence of events, or whether it can return nested event iteratorsGet an iterator over all the prefixes declared in this namespace context.next()
Get the next event in the sequence
-
Constructor Details
-
NamespaceMaintainer
Create a namespace context for a pull-events pipeline- Parameters:
base
- the previous stage in the pipeline, from which events are read
-
-
Method Details
-
isFlatSequence
public boolean isFlatSequence()Determine whether the EventIterator returns a flat sequence of events, or whether it can return nested event iterators- Specified by:
isFlatSequence
in interfaceEventIterator
- Returns:
- true if the next() method is guaranteed never to return an EventIterator
-
next
Get the next event in the sequence- Specified by:
next
in interfaceEventIterator
- Returns:
- the next event, or null when the sequence is exhausted. Note that since an EventIterator is itself a PullEvent, this method may return a nested iterator.
- Throws:
XPathException
- if a dynamic evaluation error occurs
-
getURIForPrefix
Get the namespace URI corresponding to a given prefix. Return null if the prefix is not in scope.- Specified by:
getURIForPrefix
in interfaceNamespaceResolver
- Parameters:
prefix
- the namespace prefixuseDefault
- true if the default namespace is to be used when the prefix is ""- Returns:
- the uri for the namespace, or null if the prefix is not in scope
-
iteratePrefixes
Get an iterator over all the prefixes declared in this namespace context. This will include the default namespace (prefix="") and the XML namespace where appropriate- Specified by:
iteratePrefixes
in interfaceNamespaceResolver
- Returns:
- an iterator over all the prefixes for which a namespace binding exists, including the zero-length string to represent the null/absent prefix if it is bound
-