public void startElement()

in streampipes-extensions/streampipes-pipeline-elements-experimental-flink/src/main/java/com/kohlschutter/boilerpipe/sax/HTMLHighlighter.java [342:407]


    public void startElement(String uri, String localName, String qName, Attributes atts)
        throws SAXException {
      TagAction ta = TAG_ACTIONS.get(localName);
      if (ta != null) {
        ta.beforeStart(this, localName);
      }

      // HACK: remove existing highlight
      boolean ignoreAttrs = false;
      if ("SPAN".equalsIgnoreCase(localName)) {
        String classVal = atts.getValue("class");
        if ("x-boilerpipe-mark1".equals(classVal)) {
          ignoreAttrs = true;
        }
      }

      try {
        if (inIgnorableElement == 0) {
          if (outputHighlightOnly) {
            // boolean highlight = contentBitSet
            // .get(characterElementIdx);

            // if (!highlight) {
            // return;
            // }
          }

          final Set<String> whitelistAttributes;
          if (tagWhitelist == null) {
            whitelistAttributes = null;
          } else {
            whitelistAttributes = tagWhitelist.get(qName);
            if (whitelistAttributes == null) {
              // skip
              return;
            }
          }

          html.append('<');
          html.append(qName);
          if (!ignoreAttrs) {
            final int numAtts = atts.getLength();
            for (int i = 0; i < numAtts; i++) {
              final String attr = atts.getQName(i);

              if (whitelistAttributes != null && !whitelistAttributes.contains(attr)) {
                // skip
                continue;
              }

              final String value = atts.getValue(i);
              html.append(' ');
              html.append(attr);
              html.append("=\"");
              html.append(xmlEncode(value));
              html.append("\"");
            }
          }
          html.append('>');
        }
      } finally {
        if (ta != null) {
          ta.afterStart(this, localName);
        }
      }
    }