code: public void generate( com.greenpepper.document.Document document )
      {
  
          this.document = document;
  
          createEmptyDocument();
          Statistics compiler = document.getStatistics();
          Element element = dom.createElement( DOCUMENT );
          root.appendChild( element );
  
  		if (!StringUtil.isEmpty(document.getName()))
  		{
  			addTextValue( element, DOCUMENT_NAME, document.getName(), true);
  		}
  
  		if (!StringUtil.isEmpty(document.getExternalLink()))
  		{
  			addTextValue( element, DOCUMENT_EXTERNAL_LINK, document.getExternalLink(), true);
  		}
  
  		if (document.getSections() != null && document.getSections().length > 0)
  		{
  			Element sections = dom.createElement( SECTIONS );
  			root.appendChild(sections);
  			
  			for (String section : document.getSections())
  			{
  				addTextValue( sections, SECTION, section, true);
  			}
  		}
  
  		Element time = dom.createElement( TIME );
  		element.appendChild( time );
  
          Element stats = dom.createElement( STATISTICS );
          element.appendChild( stats );
  
          StringWriter buffer = new StringWriter();
          PrintWriter writer = new PrintWriter( buffer );
          document.print( writer );
          writer.flush();
  
  		addNumberValue( time, EXECUTION_TIME, document.getTimeStatistics().getExecution() );
  		addNumberValue( time, TOTAL_TIME, document.getTimeStatistics().getTotal() );
          addTextValue( element, RESULTS, buffer.toString(), true );
          addNumberValue( stats, SUCCESS, compiler.rightCount() );
          addNumberValue( stats, FAILURE, compiler.wrongCount() );
          addNumberValue( stats, ERROR, compiler.exceptionCount() );
          addNumberValue( stats, IGNORED, compiler.ignoredCount() );
      }
docs: {@inheritDoc}