예제 #1
0
  public void createAndAddIndexGroups(
      final IndexEntry[] theIndexEntries,
      final IndexConfiguration theConfiguration,
      final Document theDocument,
      final Locale theLocale) {
    final IndexComparator indexEntryComparator = new IndexComparator(theLocale);

    final IndexGroup[] indexGroups =
        indexGroupProcessor.process(theIndexEntries, theConfiguration, theLocale);

    final Element rootElement = theDocument.getDocumentElement();

    final Element indexGroupsElement = theDocument.createElementNS(namespace_url, "index.groups");
    indexGroupsElement.setPrefix(prefix);

    for (final IndexGroup group : indexGroups) {
      // Create group element
      final Node groupElement = theDocument.createElementNS(namespace_url, "index.group");
      groupElement.setPrefix(prefix);
      // Create group label element and index entry childs
      final Element groupLabelElement = theDocument.createElementNS(namespace_url, "label");
      groupLabelElement.setPrefix(prefix);
      groupLabelElement.appendChild(theDocument.createTextNode(group.getLabel()));
      groupElement.appendChild(groupLabelElement);

      final Node[] entryNodes =
          transformToNodes(group.getEntries(), theDocument, indexEntryComparator);
      for (final Node entryNode : entryNodes) {
        groupElement.appendChild(entryNode);
      }

      indexGroupsElement.appendChild(groupElement);
    }

    rootElement.appendChild(indexGroupsElement);
  }
예제 #2
0
 public void setLogger(final DITAOTLogger logger) {
   this.logger = logger;
   indexDitaProcessor.setLogger(logger);
   indexGroupProcessor.setLogger(logger);
 }