code: private void writeDuration(long beginTime) throws XMLStreamException {
          xmlStreamWriter.writeStartElement("duration");
          xmlStreamWriter.writeCharacters(Long.toString(System.currentTimeMillis() - beginTime));
          xmlStreamWriter.writeEndElement(); // duration
      }
docs: Writes the duration.
  
  @param beginTime
  The begin time.
  @throws XMLStreamException
  If writing fails.