system/src/sc/lang/html/HTMLElement.java
public static String validateClientHTML(String htmlStr, Set<String> allowedTags, Set<String> allowedAtts) {
      if (htmlStr == null)
         return null;
      HTMLLanguage lang = HTMLLanguage.getHTMLLanguage();

      Object parseRes = lang.parseString(htmlStr);
      if (parseRes instanceof ParseError) {
         return parseRes.toString();
      }
      else {
         Object semNode = ParseUtil.nodeToSemanticValue(parseRes);
         if (!(semNode instanceof Template))
            return "Invalid parse result";
         Template templ = (Template) semNode;
         if (templ.templateDeclarations == null)
            return null;
         for (Object decl:templ.templateDeclarations) {
            if (decl instanceof CharSequence)
               continue;
            if (decl instanceof Element) {
               Element tag = (Element) decl;

               String childRes = validateTagTree(tag, allowedTags, allowedAtts);
               if (childRes != null)
                  return childRes;
            }
            else
               return "Invalid contents in template";
         }
      }
      return null;
   }
/** Parses and validates the HTML provided in htmlStr. If allowedTags is not null, only tags with those names are allowed  */
Parses and validates the HTML provided in htmlStr. If allowedTags is not null, only tags with those names are allowed
Parses and validates the HTML provided in htmlStr . If allowedTags is not null only tags with those names are allowed
public static String validateClientHTML(String htmlStr, Set<String> allowedTags, Set<String> allowedAtts) {
      if (htmlStr == null)
         return null;
      HTMLLanguage lang = HTMLLanguage.getHTMLLanguage();
      Object parseRes = lang.parseString(htmlStr);
      if (parseRes instanceof ParseError) {
         return parseRes.toString();
      }
      else {
         Object semNode = ParseUtil.nodeToSemanticValue(parseRes);
         if (!(semNode instanceof Template))
            return "Invalid parse result";
         Template templ = (Template) semNode;
         if (templ.templateDeclarations == null)
            return null;
         for (Object decl:templ.templateDeclarations) {
            if (decl instanceof CharSequence)
               continue;
            if (decl instanceof Element) {
               Element tag = (Element) decl;
               String childRes = validateTagTree(tag, allowedTags, allowedAtts);
               if (childRes != null)
                  return childRes;
            }
            else
               return "Invalid contents in template";
         }
      }
      return null;
   }
public static String validateClientHTML ( String htmlStr , Set < String > allowedTags , Set < String > allowedAtts ) { if ( htmlStr == null ) return null ; HTMLLanguage lang = HTMLLanguage . getHTMLLanguage ( ) ; Object parseRes = lang . parseString ( htmlStr ) ; if ( parseRes instanceof ParseError ) { return parseRes . toString ( ) ; } else { Object semNode = ParseUtil . nodeToSemanticValue ( parseRes ) ; if ( ! ( semNode instanceof Template ) ) return "Invalid parse result" ; Template templ = ( Template ) semNode ; if ( templ . templateDeclarations == null ) return null ; for ( Object decl : templ . templateDeclarations ) { if ( decl instanceof CharSequence ) continue ; if ( decl instanceof Element ) { Element tag = ( Element ) decl ; String childRes = validateTagTree ( tag , allowedTags , allowedAtts ) ; if ( childRes != null ) return childRes ; } else return "Invalid contents in template" ; } } return null ; }
Parses and validates the HTML provided in htmlStr.
Parses and validates the HTML provided in htmlStr .