code: protected void beforeMarkup() {
          int soFar = stack[depth];
          if ((soFar & WROTE_DATA) == 0 // no data in this scope
                  && (depth > 0 || soFar != 0)) {
              try {
                  writeNewLine(depth);
                  if (depth > 0 && getIndent().length() > 0) {
                      afterMarkup(); // indentation was written
                  }
              } catch (Exception e) {
                  e.printStackTrace();
              }
          }
      }
docs: Prepare to write markup, by writing a new line and indentation.