/**
  * Check whether the passed text looks like it contains XHTML code. This is a heuristic check only
  * and does not perform actual parsing!
  *
  * @param sText The text to check.
  * @return <code>true</code> if the text looks like HTML
  */
 public static boolean looksLikeXHTML(@Nullable final String sText) {
   // If the text contains an open angle bracket followed by a character that
   // we think of it as HTML
   // (?s) enables the "dotall" mode - see Pattern.DOTALL
   return StringHelper.hasText(sText)
       && RegExHelper.stringMatchesPattern("(?s).*<[a-zA-Z].+", sText);
 }
  @Nullable
  public static String beanCamelCaseName(@Nullable final String sInput) {
    if (StringHelper.hasNoText(sInput)) return sInput;

    // required if a string contains both "." and "_"
    final String s = RegExHelper.stringReplacePattern("\\.", sInput, "_");

    // avoid creating StringBuilder if not necessary
    if (s.indexOf('_') == -1)
      return beanUpperCaseFirstChar(RegExHelper.stringReplacePattern("\\$", s, "_"));

    final StringBuilder ret = new StringBuilder(s.length());
    for (final String sPart : StringHelper.getExploded('_', s))
      ret.append(beanUpperCaseFirstChar(sPart));
    // This replacement is required for nested classes!
    return RegExHelper.stringReplacePattern("\\$", ret.toString(), "_");
  }
    /**
     * Initialization method.
     *
     * @param sSearchTerms The search term string. It is internally separated into multiple tokens
     *     by using a "\s+" regular expression.
     * @return this
     */
    @Nonnull
    protected Finder initialize(@Nonnull @Nonempty final String sSearchTerms) {
      if (StringHelper.hasNoTextAfterTrim(sSearchTerms))
        throw new IllegalArgumentException("SearchTerms");

      // Split search terms by white spaces
      m_aSearchTerms = RegExHelper.getSplitToArray(sSearchTerms.trim(), "\\s+");
      if (m_aSearchTerms.length == 0)
        throw new IllegalStateException(
            "Weird - splitting of '" + sSearchTerms.trim() + "' failed!");
      for (final String sSearchTerm : m_aSearchTerms)
        if (sSearchTerm.length() == 0)
          throw new IllegalArgumentException("Weird - empty search term present!");
      return this;
    }
 public CSSFiles(@Nonnull final IReadableResource aFile) {
   final IMicroDocument aDoc = MicroReader.readMicroXML(aFile);
   if (aDoc != null) {
     final IMicroElement eRoot = aDoc.getDocumentElement();
     if (eRoot.getTagName().equals("list")) {
       // Old style
       s_aLogger.warn("CSS file " + aFile.getPath() + " is in old syntax");
       final List<String> aAllCSSFiles = new ArrayList<String>();
       if (XMLListHandler.readList(eRoot, aAllCSSFiles).isFailure())
         s_aLogger.error("Failed to read " + aFile.getPath());
       for (final String sCSS : aAllCSSFiles) addGlobalItem(null, sCSS, null);
     } else {
       // New style
       for (final IMicroElement eChild : eRoot.getAllChildElements("css")) {
         final String sCondComment = eChild.getAttribute("condcomment");
         final String sPath = eChild.getAttribute("path");
         if (StringHelper.hasNoText(sPath)) {
           s_aLogger.error("Found CSS item without a path in " + aFile.getPath());
           continue;
         }
         final String sMedia = eChild.getAttribute("media");
         // ESCA-JAVA0261:
         final Set<ECSSMedium> aMediaList = new LinkedHashSet<ECSSMedium>();
         if (sMedia != null)
           for (final String sMedium : RegExHelper.getSplitToArray(sMedia, ",\\s*")) {
             final ECSSMedium eMedium = ECSSMedium.getFromNameOrNull(sMedium);
             if (eMedium == null) {
               s_aLogger.warn(
                   "CSS item '"
                       + sPath
                       + "' in "
                       + aFile.getPath()
                       + " has an invalid medium '"
                       + sMedium
                       + "' - ignoring");
               continue;
             }
             aMediaList.add(eMedium);
           }
         addGlobalItem(sCondComment, sPath, aMediaList);
       }
     }
   }
 }