code: private void outputIndexTerm(final IndexTerm term, final XMLSerializer serializer) throws SAXException {
          List<IndexTermTarget> targets = term.getTargetList();
          final List<IndexTerm> subTerms = term.getSubTerms();
  
          serializer.writeStartElement("li");
  
          //if term doesn't have target to link to, it won't appear in the index tab
          //we need to create links for such terms
          if (targets.isEmpty()) {
              findTargets(term);
              targets = term.getTargetList();
          }
  
          if (targets.isEmpty()) {
              serializer.writeCharacters(term.getTermFullName());
          } else {
              final IndexTermTarget target = targets.get(0);
              serializer.writeStartElement("a");
              serializer.writeAttribute("href", target.getTargetURI());
              serializer.writeCharacters(term.getTermFullName());
              serializer.writeEndElement(); // a
          }
          if (subTerms.size() > 0) {
              serializer.writeStartElement("ul");
              for (final IndexTerm subTerm : subTerms) {
                  outputIndexTerm(subTerm, serializer);
              }
              serializer.writeEndElement(); // ul
          }
          serializer.writeEndElement(); // li
      }
docs: Output the given indexterm into the XML writer.
  
  @param term term to serializer
  @param serializer XML output to write to