Exemple #1
0
 /**
  * Given an HTML tag, split it into its tag type and tag attributes, cleaning up the attribtues in
  * the process - allowing Javascript action tags to be used as attributes (onmouseover, etc) is a
  * bad thing, so clean up HTML tags to remove any such attributes.
  */
 protected static String[] parseHtmlTag(String tag) {
   Matcher m = TAG_PATTERN.matcher(tag);
   String[] result = new String[4];
   if (!m.find()) {
     logger.severe("Failure while attempting to match html tag for pattern " + tag);
     return result;
   }
   String tagType = m.group(2).toLowerCase().trim();
   String tagAttributes = m.group(3).trim();
   String tagOpen = m.group(1).trim();
   String tagClose = m.group(5).trim();
   if (!StringUtils.isBlank(tagAttributes)) {
     tagAttributes = JFlexParserUtil.validateHtmlTagAttributes(tagAttributes).trim();
   }
   result[0] = tagType;
   result[1] = tagAttributes;
   result[2] = tagOpen;
   result[3] = tagClose;
   return result;
 }