Package jodd.csselly

Class CSSelly


  • public class CSSelly
    extends java.lang.Object
    CSS selector parser. Works with one query, i.e. does not support groups of selectors (selectors separated by a comma). To parse selectors group, manually split the group query into single queries and parse each. See: http://www.w3.org/TR/css3-selectors/#w3cselgrammar
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected jodd.csselly.CSSellyLexer lexer  
    • Constructor Summary

      Constructors 
      Constructor Description
      CSSelly​(char[] input)  
      CSSelly​(java.lang.String input)  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.util.List<CssSelector> parse()
      Parses selector string.
      static java.util.List<java.util.List<CssSelector>> parse​(java.lang.String query)
      Parses string of selectors (separated with ,).
      static java.lang.String toString​(java.util.List<CssSelector> selectors)
      Returns string representation of given list of selectors.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • lexer

        protected final jodd.csselly.CSSellyLexer lexer
    • Constructor Detail

      • CSSelly

        public CSSelly​(java.lang.String input)
      • CSSelly

        public CSSelly​(char[] input)
    • Method Detail

      • parse

        public java.util.List<CssSelector> parse()
        Parses selector string. Returns null if no selector can be parsed.
      • parse

        public static java.util.List<java.util.List<CssSelector>> parse​(java.lang.String query)
        Parses string of selectors (separated with ,). Returns list of CssSelector lists in the same order.
      • toString

        public static java.lang.String toString​(java.util.List<CssSelector> selectors)
        Returns string representation of given list of selectors.