Ejemplo n.º 1
0
  private static Element addLink(Element parent, Entry entry, Document doc) {
    Element link = doc.createElementNS(null, "link");
    parent.appendChild(link);

    link.setAttributeNS(null, "class", "- topic/link ");

    link.setAttributeNS(null, "href", entry.href);

    if (entry.scope != null) {
      link.setAttributeNS(null, "scope", entry.scope);
    }

    if (entry.format != null) {
      link.setAttributeNS(null, "format", entry.format);
    }

    if (entry.linktext != null) {
      Element linktext = (Element) doc.importNode(entry.linktext, /*deep*/ true);
      linktext.setAttributeNS(null, "class", "- topic/linktext ");
      link.appendChild(linktext);
    }

    if (entry.shortdesc != null) {
      Element desc = doc.createElementNS(null, "desc");
      desc.setAttributeNS(null, "class", "- topic/desc ");
      link.appendChild(desc);

      DOMUtil.copyChildren(entry.shortdesc, desc, doc);
    }

    return link;
  }
Ejemplo n.º 2
0
  private void processColumn(
      Element reltable,
      int column,
      LoadedDocuments loadedDocs,
      List<Entry> entryList,
      List<Entry[]> cellList) {
    Node child = reltable.getFirstChild();
    while (child != null) {
      if (child.getNodeType() == Node.ELEMENT_NODE) {
        Element childElement = (Element) child;

        if (DITAUtil.hasClass(childElement, "map/relrow")) {
          Element relcell = DOMUtil.getNthChildElement(childElement, column);
          if (relcell != null && DITAUtil.hasClass(relcell, "map/relcell")) {
            entryList.clear();
            processCell(relcell, loadedDocs, entryList);

            Entry[] entries = new Entry[entryList.size()];
            entryList.toArray(entries);
            cellList.add(entries);
          }
        }
      }

      child = child.getNextSibling();
    }
  }