@Override
  public void putAttributes(AttributeGenerator generator) {
    super.putAttributes(generator);

    if (encoding != Encoding.NONE) {
      generator.put(ATTRIBUTE_ENCODING, encoding.name().toLowerCase());
    }
  }
  @Override
  protected void consumeAttributes(AttributeHelper helper) throws ParseException {
    super.consumeAttributes(helper);

    String enc = helper.consume(ATTRIBUTE_ENCODING, false);
    if (enc != null) {
      this.encoding = Encoding.valueOf(enc.toUpperCase());
    } else {
      this.encoding = Encoding.NONE;
    }
  }