|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.codehaus.staxmate.in.SMInputCursor
org.codehaus.staxmate.in.SMFlatteningCursor
public class SMFlatteningCursor
Default implementation of generic flat (non-scoped) cursor; cursor that traverse all descendants (children and grandchildren) of a start element.
Differences to SMHierarchicCursor are:
XMLStreamConstants.END_ELEMENT nodes (except
for the one that closes the outermost level), unless
filtered out by the filter, whereas the nested cursor automatically
leaves those out.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class org.codehaus.staxmate.in.SMInputCursor |
|---|
SMInputCursor.State, SMInputCursor.Tracking |
| Field Summary | |
|---|---|
protected int |
mNesting
Number of nested start elements this element has iterated over, including current one (if pointing to one) |
| Fields inherited from class org.codehaus.staxmate.in.SMInputCursor |
|---|
mChildCursor, mCurrEvent, mData, mElemCount, mElemInfoFactory, mElemTracking, mFilter, mNodeCount, mParentCount, mParentTrackedElement, mState, mStreamReader, mTrackedElement, sEventsByIds |
| Constructor Summary | |
|---|---|
SMFlatteningCursor(SMInputCursor parent,
org.codehaus.stax2.XMLStreamReader2 sr,
SMFilter f)
|
|
| Method Summary | |
|---|---|
SMInputCursor |
constructChildCursor(SMFilter f)
|
SMInputCursor |
constructDescendantCursor(SMFilter f)
|
int |
getDepth()
Returns number of parent elements current node (or, the last node cursor pointed to, or in absence of one [before cursor has been advanced for the first time], it would point if advanced) has. |
SMEvent |
getNext()
Main iterating method. |
protected void |
skipTree()
Method called by the parent cursor, to skip over the scope this cursor iterates, and of its sub-scopes if any. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
protected int mNesting
| Constructor Detail |
|---|
public SMFlatteningCursor(SMInputCursor parent,
org.codehaus.stax2.XMLStreamReader2 sr,
SMFilter f)
| Method Detail |
|---|
public int getDepth()
SMInputCursor
For example, here are expected results for getDepth()
for an example XML document:
<!-- Comment outside tree --> [0]
<root> [0]
Text [1]
<branch> [1]
Inner text [2]
<child /> [2]
</branch> [1]
</root> [0]
Numbers in bracket are depths that would be returned when the
cursor points to the node.
Note: depths are different from what some APIs (such as XmlPull) return.
getDepth in class SMInputCursor
public SMEvent getNext()
throws javax.xml.stream.XMLStreamException
SMInputCursor
getNext in class SMInputCursorXMLStreamConstants, such as
XMLStreamConstants.START_ELEMENT, if a new node was
iterated over; null when there are no more
nodes this cursor can iterate over.
javax.xml.stream.XMLStreamExceptionpublic SMInputCursor constructChildCursor(SMFilter f)
constructChildCursor in class SMInputCursorpublic SMInputCursor constructDescendantCursor(SMFilter f)
constructDescendantCursor in class SMInputCursor
protected void skipTree()
throws javax.xml.stream.XMLStreamException
Note: implementation differs from that of non-flattening cursor mostly since we may be deeper down in the tree already, and thus may need to encounter multiple end tags.
skipTree in class SMInputCursorjavax.xml.stream.XMLStreamException
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||