private void processEndTag ( ) throws XMLStreamException , TTException { mLevelInToShredder -- ; if ( mInserted ) { mInsertedEndTag = true ; } if ( mRemovedNode ) { mRemovedNode = false ; } else { // Move cursor to parent. if ( mWtx . getNode ( ) . getDataKey ( ) == mLastNodeKey ) { /* * An end tag must have been parsed immediately before and it * must have been an empty element at the end of a subtree, thus * move this time to parent node. */ assert mWtx . getNode ( ) . hasParent ( ) && mWtx . getNode ( ) . getKind ( ) == IConstants . ELEMENT ; mWtx . moveTo ( mWtx . getNode ( ) . getParentKey ( ) ) ; } else { if ( mWtx . getNode ( ) . getKind ( ) == IConstants . ELEMENT ) { final ElementNode element = ( ElementNode ) mWtx . getNode ( ) ; if ( element . hasFirstChild ( ) && element . hasParent ( ) ) { // It's not an empty element, thus move to parent. mWtx . moveTo ( mWtx . getNode ( ) . getParentKey ( ) ) ; } // } else { // checkIfLastNode(true); // } } else if ( ( ( ITreeStructData ) mWtx . getNode ( ) ) . hasParent ( ) ) { if ( ( ( ITreeStructData ) mWtx . getNode ( ) ) . hasRightSibling ( ) ) { mWtx . moveTo ( ( ( ITreeStructData ) mWtx . getNode ( ) ) . getRightSiblingKey ( ) ) ; /* * Means next event is an end tag in StAX reader, but * something different where the Treetank transaction * points to, which also means it has to be deleted. */ mKeyMatches = - 1 ; mDelete = EDelete . ATBOTTOM ; deleteNode ( ) ; } mWtx . moveTo ( mWtx . getNode ( ) . getParentKey ( ) ) ; } } mLastNodeKey = mWtx . getNode ( ) . getDataKey ( ) ; // Move cursor to right sibling if it has one. if ( ( ( ITreeStructData ) mWtx . getNode ( ) ) . hasRightSibling ( ) ) { mWtx . moveTo ( ( ( ITreeStructData ) mWtx . getNode ( ) ) . getRightSiblingKey ( ) ) ; mMovedToRightSibling = true ; skipWhitespaces ( mReader ) ; if ( mReader . peek ( ) . getEventType ( ) == XMLStreamConstants . END_ELEMENT ) { /* * Means next event is an end tag in StAX reader, but * something different where the Treetank transaction points * to, which also means it has to be deleted. */ mKeyMatches = - 1 ; mDelete = EDelete . ATBOTTOM ; deleteNode ( ) ; } } else { mMovedToRightSibling = false ; } } }
Process end tag .