code: @Override
      public final void attribute(String name, String value) throws IllegalStateException, IllegalArgumentException, IOException {
  
          // Check state
          if (_state != XMLEventListenerStates.START_TAG_OPEN) {
              throw new IllegalStateException("getState() == " + _state);
  
              // Check arguments
          } else if (name == null || value == null) {
              if (name == null && value == null) {
                  throw new IllegalArgumentException("name == null && value == null");
              } else if (name == null) {
                  throw new IllegalArgumentException("name == null");
              } else {
                  throw new IllegalArgumentException("value == null");
              }
          }
  
          // Temporarily set the state to ERROR_STATE. Unless an exception is
          // thrown in the write methods, it will be reset to a valid state.
          _state = XMLEventListenerStates.ERROR_STATE;
  
          // Write output
          _encoder.attribute(_out, name, value, _quotationMark, _escapeAmpersands);
  
          // Reset the state
          _state = XMLEventListenerStates.START_TAG_OPEN;
  
          // State has changed, check
          checkInvariants();
      }
docs: Adds an attribute to the current element, with a <code>String</code> value. There must
  currently be an open element.
  <p />
  The attribute value is surrounded by the quotation mark character (see
  {@link #getQuotationMark()}).
  
  @param name  the name of the attribute, not <code>null</code>.
  @param value the value of the attribute, not <code>null</code>.
  @throws IllegalStateException    if <code>getState() != {@link #START_TAG_OPEN}</code>.
  @throws IllegalArgumentException if <code>name == null || value == null</code>.
  @throws IOException              if an I/O error occurs; this will set the state to {@link #ERROR_STATE}.