|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface PullProvider
PullProvider is Saxon's pull-based interface for reading XML documents and XDM sequences. A PullProvider can deliver any sequence of nodes or atomic values. An atomic value in the sequence is delivered as a single event; a node is delivered as a sequence of events equivalent to a recursive walk of the XML tree. Within this sequence, the start and end of a document, or of an element, are delivered as separate events; other nodes are delivered as individual events.
Field Summary | |
---|---|
static int |
ATOMIC_VALUE
ATOMIC_VALUE is notified when the PullProvider is reading a sequence of items, and one of the items is an atomic value rather than a node. |
static int |
ATTRIBUTE
The ATTRIBUTE event is notified only for an attribute node that appears in its own right as a top-level item in the sequence being read. |
static int |
COMMENT
A COMMENT event is notified for a comment node, which may be either a top-level comment or one nested within an element or document node. |
static int |
END_DOCUMENT
END_DOCUMENT is notified at the end of processing a document node, that is, after all the descendants of the document node have been notified. |
static int |
END_ELEMENT
END_ELEMENT is notified at the end of an element node, that is, after all the children and descendants of the element have either been processed or skipped. |
static int |
END_OF_INPUT
The END_OF_INPUT event is returned to indicate the end of the sequence being read. |
static int |
NAMESPACE
The NAMESPACE event is notified only for a namespace node that appears in its own right as a top-level item in the sequence being read. |
static int |
PROCESSING_INSTRUCTION
A PROCESSING_INSTRUCTION event is notified for a processing instruction node, which may be either a top-level comment or one nested within an element or document node. |
static int |
START_DOCUMENT
START_DOCUMENT is notified when a document node is encountered. |
static int |
START_ELEMENT
START_ELEMENT is notified when an element node is encountered. |
static int |
START_OF_INPUT
START_OF_INPUT is the initial state when the PullProvider is instantiated. |
static int |
TEXT
A TEXT event is notified for a text node. |
Method Summary | |
---|---|
void |
close()
Close the event reader. |
int |
current()
Get the event most recently returned by next(), or by other calls that change the position, for example getStringValue() and skipToMatchingEnd(). |
AtomicValue |
getAtomicValue()
Get an atomic value. |
AttributeCollection |
getAttributes()
Get the attributes associated with the current element. |
int |
getFingerprint()
Get the fingerprint of the name of the element. |
int |
getNameCode()
Get the nameCode identifying the name of the current node. |
NamespaceDeclarations |
getNamespaceDeclarations()
Get the namespace declarations associated with the current element. |
PipelineConfiguration |
getPipelineConfiguration()
Get configuration information. |
SourceLocator |
getSourceLocator()
Get the location of the current event. |
CharSequence |
getStringValue()
Get the string value of the current element, text node, processing-instruction, or top-level attribute or namespace node, or atomic value. |
int |
getTypeAnnotation()
Get the type annotation of the current attribute or element node, or atomic value. |
List |
getUnparsedEntities()
Get a list of unparsed entities. |
int |
next()
Get the next event |
void |
setPipelineConfiguration(PipelineConfiguration pipe)
Set configuration information. |
int |
skipToMatchingEnd()
Skip the current subtree. |
Field Detail |
---|
static final int START_OF_INPUT
static final int ATOMIC_VALUE
static final int START_DOCUMENT
static final int END_DOCUMENT
static final int START_ELEMENT
Following the notification of START_ELEMENT, the client may obtain information about the element node, such as its name and type annotation. The client may also call getAttributes() to obtain information about the attributes of the element node, and/or getNamespaceDeclarations() to get information about the namespace declarations. The client may then do one of the following:
static final int END_ELEMENT
static final int ATTRIBUTE
getAttributes()
method.
static final int NAMESPACE
getNamespaceDeclarations()
method.
static final int TEXT
static final int COMMENT
static final int PROCESSING_INSTRUCTION
static final int END_OF_INPUT
Method Detail |
---|
void setPipelineConfiguration(PipelineConfiguration pipe)
pipe
- the pipeline configurationPipelineConfiguration getPipelineConfiguration()
int next() throws XPathException
END_OF_INPUT
is returned at the end of the sequence.
XPathException
int current()
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 skipToMatchingEnd(), getStringValue(), or getTypedValue().
XPathException
NamespaceDeclarations getNamespaceDeclarations() throws XPathException
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 skipToMatchingEnd(), getStringValue(), or getTypedValue().
XPathException
int skipToMatchingEnd() throws XPathException
IllegalStateException
- if the method is called at any time other than
immediately after a START_DOCUMENT or START_ELEMENT event.
XPathException
void close()
END_OF_INPUT
has
been reported, but it is recommended to close it if reading terminates
prematurely. Once an event reader has been closed, the effect of further
calls on next() is undefined.
int getNameCode()
START_ELEMENT
, PROCESSING_INSTRUCTION
,
ATTRIBUTE
, or NAMESPACE
events. With some PullProvider implementations,
it can also be used after END_ELEMENT
, but this is not guaranteed: a client who
requires the information at that point (for example, to do serialization) should insert an
ElementNameTracker
into the pipeline.
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.
int getFingerprint()
START_ELEMENT
, END_ELEMENT
, PROCESSING_INSTRUCTION
,
ATTRIBUTE
, or NAMESPACE
events.
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.
CharSequence getStringValue() throws XPathException
In other situations the result is undefined and may result in an IllegalStateException.
If the most recent event was a START_ELEMENT
, this method causes the content
of the element to be read. The current event on completion of this method will be the
corresponding END_ELEMENT
. The next call of next() will return the event following
the END_ELEMENT event.
XPathException
int getTypeAnnotation()
SchemaType
by access to the Configuration.AtomicValue getAtomicValue()
SourceLocator getSourceLocator()
List getUnparsedEntities()
UnparsedEntity
|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |