code: protected boolean replace(org.htmlparser.Tag tag) {
  
          boolean result = false;
          String tagName = tag.getTagName().trim().toLowerCase();
          String replacementName = (String)m_tags2replacementTags.get(tagName);
          if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(replacementName)) {
              // judge this as a bug: getTagName() returns plain name, setter needs leading '/' for
              // TODO: when updating htmlparser, verify if this has changed / been fixed
              // closing tags
              if (tag.isEndTag()) {
                  replacementName = "/" + replacementName;
              }
              tag.setTagName(replacementName);
              result = true;
              // clear the attributes too:
              List attributes = tag.getAttributesEx();
              Iterator itAttribs = attributes.iterator();
              // skip the "tagname attribute"....
              itAttribs.next();
              Attribute attribute;
              String attName;
              while (itAttribs.hasNext()) {
                  attribute = (Attribute)itAttribs.next();
                  attName = attribute.getName();
                  if (CmsStringUtil.isEmptyOrWhitespaceOnly(attName)) {
                      // this is the case for e.g. <h1 >
                      // -> becomes a tag with an attribute for tag name and a null name attribute
                      // (for the whitespace!)
                  } else {
                      if (LOG.isDebugEnabled()) {
                          LOG.debug(
                              Messages.get().getBundle().key(
                                  Messages.LOG_DEBUG_TAGREPLACE_TAG_REMOVE_ATTRIB_2,
                                  attName,
                                  tag.getTagName()));
  
                      }
                      itAttribs.remove();
                      if (LOG.isDebugEnabled()) {
                          LOG.debug(Messages.get().getBundle().key(Messages.LOG_DEBUG_TAGREPLACE_TAG_REMOVE_ATTRIB_OK_0));
                      }
                  }
              }
          }
          return result;
      }
docs: Transforms the given Tag into the one it has to become by changing it's name and/or
  attributes.
  <p>
  
  @param tag the tag to be transformed.
  
  @return true if the given tag was modified, false else.