The following Jsoup statement works:
Elements divs = document.select("div[class=mncls sbucls]");
But the equivalent statment:
Elements divs = document.select("div.mncls sbucls");
Doesn't work.
Why?
Does Jsoup have a pr开发者_运维知识库oblem with class names that have spaces?
A space is a descendent selector:
http://www.w3.org/TR/CSS2/selector.html#descendant-selectors
In your second example, when you put the space in there, you're denoting another element/class/selector, whereas in your first example you're explicitly grouping the selector into a single string (including the space).
Class names can not have a space. It's a CSS Specification, nothing to do with Jsoup. Technically mncls sbucls is two separate classes (mncls and sbucls).
The attribute selector works because you're selecting the class attribute where the value is mncls sbucls
加载中,请稍侯......
精彩评论