|
Qizx fe-4.4p2 API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface XMLPullStream
Streaming input of XML contents, working in 'pull' mode.
An object implementing this interface delivers the contents of an XML Node as a stream of "events", enumerated under control of the calling code (hence the term "pull mode"). An element appears as a pair of events ELEMENT_START, ELEMENT_END enclosing the events corresponding to the contents of the element. Atomic nodes (text, comment, PI) appear as a single event.
The stream is forward only. A method moveToNextEvent()
both moves
the stream to the next event and returns the type of this event
(ELEMENT_START, TEXT, ELEMENT_END etc.). The current event type is also
available through the method getCurrentEvent()
.
Other methods provide access to event-specific values such as element name, attributes, namespace declarations, textual contents.
Note: this interface is similar to javax.xml.stream.XMLStreamReader in essence, but it is fully compliant with the XQuery/XPath2 Data Model and it is simpler. The iteration style is slightly different since there is no hasNext() method.
Field Summary | |
---|---|
static int |
COMMENT
Value returned by moveToNext and getEvent when a comment is reached. |
static int |
DOCUMENT_END
Value returned by moveToNext and getEvent when the end of the document is reached. |
static int |
DOCUMENT_START
Value returned by moveToNext and getEvent when the beginning of a document is reached. |
static int |
ELEMENT_END
Value returned by moveToNext and getEvent when the end of an element is reached. |
static int |
ELEMENT_START
Value returned by moveToNext and getEvent when the beginning of an element is reached. |
static int |
END
Value returned by moveToNext and getEvent when the end of stream is reached. |
static int |
PROCESSING_INSTRUCTION
Value returned by moveToNext and getEvent when a processing-instruction is reached. |
static int |
START
Value returned by getEvent before the first call to moveToNext. |
static int |
TEXT
Value returned by moveToNext and getEvent when a text node is reached. |
Method Summary | |
---|---|
int |
getAttributeCount()
On ELEMENT_START, returns the number of attributes of the element. |
QName |
getAttributeName(int index)
On ELEMENT_START, returns the name of the N-th attribute of the element. |
String |
getAttributeValue(int index)
On ELEMENT_START, returns the string-value of the N-th attribute of the element. |
int |
getCurrentEvent()
Returns the same value as the latest moveToNextEvent. |
Node |
getCurrentNode()
Returns the current node, if the implementation of this object is able to. |
String |
getDTDName()
Returns the declared DTD name of the document, if any. |
String |
getDTDPublicId()
Returns the declared Public ID of the DTD, if any. |
String |
getDTDSystemId()
Returns the declared System ID of the DTD, if any. |
String |
getEncoding()
Returns the declared encoding of the document, if any. |
String |
getInternalSubset()
Returns the source form of internal subset of the DTD, if any. |
QName |
getName()
Returns the name of the current element node, or if the node is not an element, returns the name of the parent element. |
int |
getNamespaceCount()
On ELEMENT_START, returns the number of namespace declarations of the element itself. |
String |
getNamespacePrefix(int index)
On ELEMENT_START, returns the prefix of the N-th namespace declaration of the element. |
String |
getNamespaceURI(int index)
On ELEMENT_START, returns the namespace URI of the N-th namespace declaration of the element. |
String |
getTarget()
Returns the target name for a PROCESSING_INSTRUCTION. |
String |
getText()
Returns the textual contents of an atomic node. |
int |
getTextLength()
Returns the size of the textual contents of an atomic node. |
int |
moveToNextEvent()
Moves the event stream one step forward. |
Field Detail |
---|
static final int END
static final int START
static final int DOCUMENT_START
static final int DOCUMENT_END
static final int ELEMENT_START
static final int ELEMENT_END
static final int TEXT
static final int COMMENT
static final int PROCESSING_INSTRUCTION
Method Detail |
---|
int moveToNextEvent() throws DataModelException
END
.
DataModelException
- may be thrown by the stream implementation in
case access to data is impossible (deleted document, closed Library).int getCurrentEvent()
String getEncoding()
String getDTDName()
String getDTDPublicId()
String getDTDSystemId()
String getInternalSubset()
QName getName()
int getAttributeCount()
QName getAttributeName(int index)
index
- of the attribute (starting from 0)
IndexOutOfBoundsException
- if not on an element start, of the
index is invalid.String getAttributeValue(int index)
index
- of the attribute (starting from 0)
IndexOutOfBoundsException
- if not on an element start, of the
index is invalid.int getNamespaceCount()
String getNamespacePrefix(int index)
index
- of the namespace declaration (starting from 0)
IndexOutOfBoundsException
- if not on an element start, of the
index is invalid.String getNamespaceURI(int index)
index
- of the namespace declaration (starting from 0)
IndexOutOfBoundsException
- if not on an element start, of the
index is invalid.String getText()
int getTextLength()
getText()
String getTarget()
Node getCurrentNode()
|
© 2010 Axyana Software | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |