code: protected void beforeStartElement() {
          beforeMarkup();
          if (stack.length <= depth + 1) {
              // Allocate more space for the stack:
              int[] newStack = new int[stack.length * 2];
              System.arraycopy(stack, 0, newStack, 0, stack.length);
              stack = newStack;
          }
          stack[depth + 1] = 0; // nothing written yet
      }
docs: Prepare to start an element, by allocating stack space.