code: protected final void insertNewContent() throws TTException {
          try {
              Stack<Long> leftSiblingKeyStack = new Stack<Long>();
  
              leftSiblingKeyStack.push(NULL_NODE);
              boolean firstElement = true;
              int level = 0;
              QName rootElement = null;
              boolean endElemReached = false;
              StringBuilder sBuilder = new StringBuilder();
  
              // Iterate over all nodes.
              while (mReader.hasNext() && !endElemReached) {
                  final XMLEvent event = mReader.nextEvent();
  
                  switch (event.getEventType()) {
                  case XMLStreamConstants.START_ELEMENT:
                      level++;
                      leftSiblingKeyStack = addNewElement(leftSiblingKeyStack, (StartElement)event);
                      if (firstElement) {
                          firstElement = false;
                          rootElement = event.asStartElement().getName();
                      }
                      break;
                  case XMLStreamConstants.END_ELEMENT:
                      level--;
                      if (level == 0 && rootElement != null
                          && rootElement.equals(event.asEndElement().getName())) {
                          endElemReached = true;
                      }
                      leftSiblingKeyStack.pop();
                      mWtx.moveTo(leftSiblingKeyStack.peek());
                      break;
                  case XMLStreamConstants.CHARACTERS:
                      if (mReader.peek().getEventType() == XMLStreamConstants.CHARACTERS) {
                          sBuilder.append(event.asCharacters().getData().trim());
                      } else {
                          sBuilder.append(event.asCharacters().getData().trim());
                          leftSiblingKeyStack = addNewText(leftSiblingKeyStack, sBuilder.toString());
                          sBuilder = new StringBuilder();
                      }
                      break;
                  default:
                      // Node kind not known.
                  }
              }
          } catch (final XMLStreamException e) {
              throw new TTIOException(e);
          }
      }
docs: Insert new content based on a StAX parser {@link XMLStreamReader}.
  
  @throws TTException
  if something went wrong while inserting