/**
   * Appends a field.
   *
   * @param comment
   */
  private void emitField(DocComment comment) {
    xml.append("\n<field name='");
    xml.append(comment.getName());
    xml.append("' fullname='");
    xml.append(comment.getFullname());
    xml.append("' type='");
    String type = comment.getVartype();
    if (type != null) xml.append(comment.getVartype());
    xml.append("' isStatic='");
    xml.append(comment.isStatic());
    xml.append("' isConst='");
    xml.append(comment.isConst());
    xml.append("' ");
    String defaultValue = comment.getDefaultValue();
    if (defaultValue != null) {
      xml.append("defaultValue='");

      try {
        Pattern pattern = Pattern.compile("\\p{Cntrl}");
        Matcher matcher = pattern.matcher(defaultValue);
        defaultValue = matcher.replaceAll("");
      } catch (Exception ex) {
      }

      xml.append(defaultValue);
      xml.append("' ");
    }
    xml.append(">");

    String desc = comment.getDescription();
    if (desc != null) appendTag("description", comment.getDescription());
    emitTags(comment.getAllTags());

    if (comment.getMetadata() != null) emitMetadata(comment.getMetadata());
    xml.append("\n</field>");
  }