code: private void emit() throws TTIOException {
          // Emit pending end elements.
          if (mCloseElements) {
              if (!mStack.empty() && mStack.peek() != ((ITreeStructData)mRtx.getNode()).getLeftSiblingKey()) {
                  mRtx.moveTo(mStack.pop());
                  emitEndTag();
                  mRtx.moveTo(mKey);
              } else if (!mStack.empty()) {
                  mRtx.moveTo(mStack.pop());
                  emitEndTag();
                  mRtx.moveTo(mKey);
                  mCloseElements = false;
                  mCloseElementsEmitted = true;
              }
          } else {
              mCloseElementsEmitted = false;
  
              // Emit node.
              emitNode();
  
              final long nodeKey = mRtx.getNode().getDataKey();
              mLastKey = nodeKey;
  
              // Push end element to stack if we are a start element.
              if (mRtx.getNode().getKind() == ELEMENT) {
                  mStack.push(nodeKey);
              }
  
              // Remember to emit all pending end elements from stack if
              // required.
              if (!((ITreeStructData)mRtx.getNode()).hasFirstChild()
                  && !((ITreeStructData)mRtx.getNode()).hasRightSibling()) {
                  mGoUp = true;
                  moveToNextNode();
              } else if (mRtx.getNode().getKind() == ELEMENT && !((ElementNode)mRtx.getNode()).hasFirstChild()) {
                  // Case: Empty elements with right siblings.
                  mGoBack = true;
                  moveToNextNode();
              }
          }
      }
docs: Move to node and emit it.
  
  @throws IOException
  In case of any I/O error.