code: private void encodeSubject(Subject subject, PrintStream out,
                                    Indenter indenter) {
          char [] indent = indenter.makeString().toCharArray();
          out.print(indent);
          out.append("<Subject SubjectCategory=\"")
             .append(subject.getCategory().toString()).append('"');
  
          List subjectAttrs = subject.getAttributesAsList();
          
          if (subjectAttrs.size() == 0) {
              // there's nothing in this Subject, so just close the tag
              out.println("/>");
          } else {
              // there's content, so fill it in
              out.println('>');
  
              encodeAttributes(subjectAttrs, out, indenter);
          
              out.print(indent);
              out.println("</Subject>");
          }
      }
docs: Private helper function to encode the subjects