예제 #1
0
 /** Check whether the index entries we got is meaningful and valid */
 private static boolean verifyIndexEntries(final StringBuffer str) {
   if (str.length() == 0) {
     return false;
   }
   final int start = str.indexOf(GREATER_THAN); // start from first tag's end
   final int end = str.lastIndexOf(LESS_THAN); // end at last tag's start
   final String temp = str.substring(start + 1, end);
   if (temp.trim().length() != 0) {
     return true;
   }
   return false;
 }
예제 #2
0
  /**
   * Append XML content into root element
   *
   * @param hrefValue href of the topicref
   * @param parentResult XML content to insert into
   * @param tmpContent XML content to insert
   */
  private void insertAfter(String hrefValue, StringBuffer parentResult, CharSequence tmpContent) {
    int insertpoint = parentResult.lastIndexOf("</");
    final int end = parentResult.indexOf(">", insertpoint);

    if (insertpoint == -1 || end == -1) {
      logger.error(MessageUtils.getInstance().getMessage("DOTJ033E", hrefValue).toString());
    } else {
      if (ELEMENT_NAME_DITA.equals(parentResult.substring(insertpoint, end).trim())) {
        insertpoint = parentResult.lastIndexOf("</", insertpoint - 1);
      }
      parentResult.insert(insertpoint, tmpContent);
    }
  }