code: public void write(Bean bean, boolean rootType, Appendable output) throws IOException {
          if (bean == null) {
              throw new NullPointerException("bean");
          }
          this.output = output;
          this.rootBean = bean;
          this.basePackage = (rootType ? bean.getClass().getPackage().getName() + "." : null);
          
          String type = rootBean.getClass().getName();
          writeHeader();
          output.append('<').append(BEAN);
          if (rootType) {
              appendAttribute(output, TYPE, type);
          }
          output.append('>').append(settings.getNewLine());
          writeBean(rootBean, settings.getIndent());
          output.append('<').append('/').append(BEAN).append('>').append(settings.getNewLine());
      }
docs: Writes the bean to the {@code Appendable}.
  
  @param bean  the bean to output, not null
  @param rootType  true to output the root type
  @param output  the output appendable, not null
  @throws IOException if an error occurs