|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.sf.saxon.pull.PullFilter com.saxonica.pull.PullNamespaceReducer
public class PullNamespaceReducer
PullNamespaceReducer is a PullFilter responsible for removing duplicate namespace declarations. It also performs namespace fixup: that is, it ensures that the namespaces used in element and attribute names are all declared.
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
Field Summary |
---|
Fields inherited from class net.sf.saxon.pull.PullFilter |
---|
currentEvent |
Fields inherited from interface net.sf.saxon.pull.PullProvider |
---|
ATOMIC_VALUE, ATTRIBUTE, COMMENT, END_DOCUMENT, END_ELEMENT, END_OF_INPUT, NAMESPACE, PROCESSING_INSTRUCTION, START_DOCUMENT, START_ELEMENT, START_OF_INPUT, TEXT |
Constructor Summary | |
---|---|
PullNamespaceReducer(PullProvider base)
Create a namespace reducer for a pull pipeline |
Method Summary | |
---|---|
void |
endElement()
endElement: Discard the namespaces declared on this element. |
AttributeCollection |
getAttributes()
Get the attributes associated with the current element. |
int |
getNameCode()
Get the nameCode identifying the name of the current node. |
NamespaceDeclarations |
getNamespaceDeclarations()
Get the namespace declarations associated with the current element. |
protected short |
getURICode(short prefixCode)
Get the URI code corresponding to a given prefix code, by searching the in-scope namespaces. |
String |
getURIForPrefix(String prefix,
boolean useDefault)
Get the namespace URI corresponding to a given prefix. |
Iterator |
iteratePrefixes()
Get an iterator over all the prefixes declared in this namespace context. |
int |
next()
next(): handle next event. |
Methods inherited from class net.sf.saxon.pull.PullFilter |
---|
close, current, getAtomicValue, getFingerprint, getNamePool, getPipelineConfiguration, getSourceLocator, getStringValue, getTypeAnnotation, getUnderlyingProvider, getUnparsedEntities, setPipelineConfiguration, skipToMatchingEnd |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public PullNamespaceReducer(PullProvider base)
base
- the next stage in the pipeline, from which events are readMethod Detail |
---|
public 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
public int getNameCode()
PullProvider.START_ELEMENT
, PullProvider.PROCESSING_INSTRUCTION
,
PullProvider.ATTRIBUTE
, or PullProvider.NAMESPACE
events. With some PullProvider implementations,
including this one, it can also be used after PullProvider.END_ELEMENT
If called at other times, the result is undefined and may result in an IllegalStateException.
If called when the current node is an unnamed namespace node (a node representing the default namespace)
the returned value is -1.
getNameCode
in interface PullProvider
getNameCode
in class PullFilter
public 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
public NamespaceDeclarations 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
public void endElement() throws XPathException
XPathException
protected short getURICode(short prefixCode)
prefixCode
- the 16-bit prefix code required
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 iteratePrefixes()
iteratePrefixes
in interface NamespaceResolver
|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |