public class PullNamespaceReducer extends PullFilter implements NamespaceResolver
This class is derived from, and contains much common code with, the NamespaceReducer in the push pipeline. (In the push version, however, namespace fixup is not performed by the NamespaceReducer, but by the ComplexContentOutputter).
NamespaceReducer
currentEvent
ATOMIC_VALUE, ATTRIBUTE, COMMENT, END_DOCUMENT, END_ELEMENT, END_OF_INPUT, NAMESPACE, PROCESSING_INSTRUCTION, START_DOCUMENT, START_ELEMENT, START_OF_INPUT, TEXT
Constructor and Description |
---|
PullNamespaceReducer(PullProvider base)
Create a namespace reducer for a pull pipeline
|
Modifier and Type | Method and Description |
---|---|
void |
endElement()
endElement: Discard the namespaces declared on this element.
|
AttributeCollection |
getAttributes()
Get the attributes associated with the current element.
|
NamespaceBinding[] |
getNamespaceDeclarations()
Get the namespace declarations associated with the current element.
|
String |
getURIForPrefix(String prefix,
boolean useDefault)
Get the namespace URI corresponding to a given prefix.
|
Iterator<String> |
iteratePrefixes()
Get an iterator over all the prefixes declared in this namespace context.
|
int |
next()
next(): handle next event.
|
close, current, getAtomicValue, getNamePool, getNodeName, getPipelineConfiguration, getSchemaType, getSourceLocator, getStringValue, getUnderlyingProvider, getUnparsedEntities, setPipelineConfiguration, skipToMatchingEnd
public PullNamespaceReducer(PullProvider base)
base
- the next stage in the pipeline, from which events are readpublic int next() throws XPathException
next
in interface PullProvider
next
in class PullFilter
PullProvider.END_OF_INPUT
is returned at the end of the sequence.XPathException
- if a dynamic error occurspublic AttributeCollection getAttributes() throws XPathException
Attributes may be read before or after reading the namespaces of an element, but must not be read after the first child node has been read, or after calling one of the methods skipToEnd(), getStringValue(), or getTypedValue().
getAttributes
in interface PullProvider
getAttributes
in class PullFilter
XPathException
- if a dynamic error occurspublic NamespaceBinding[] getNamespaceDeclarations() throws XPathException
This class extends the semantics of the PullProvider interface by allowing this method to be called also after an END_ELEMENT event. This is to support PullToStax, which requires this functionality. In this situation it returns the namespaces declared on the startElement associated with the element that has just ended.
It is permissible for this method to return namespace declarations that are redundant.
The NamespaceDeclarations object is guaranteed to remain unchanged until the next START_ELEMENT event, but may then be overwritten. The object should not be modified by the client.
Namespaces may be read before or after reading the attributes of an element, but must not be read after the first child node has been read, or after calling one of the methods skipToEnd(), getStringValue(), or getTypedValue().
*getNamespaceDeclarations
in interface PullProvider
getNamespaceDeclarations
in class PullFilter
XPathException
- if a dynamic error occurspublic void endElement() throws XPathException
XPathException
public String getURIForPrefix(String prefix, boolean useDefault)
getURIForPrefix
in interface NamespaceResolver
prefix
- the namespace prefixuseDefault
- true if the default namespace is to be used when the
prefix is ""public Iterator<String> iteratePrefixes()
iteratePrefixes
in interface NamespaceResolver
Copyright (c) 2004-2014 Saxonica Limited. All rights reserved.