问题
I am trying to find all <div class="name1"> or <div class="name2"> tags in one page/document.
How can I use OR operator in doc.select("div.name1 OR div.name2")?
回答1:
The select method of JSoup implements more or less the CSS selector syntax. So you can very simply use the CSS way of specifying alternatives, i.e. using ,. This should work:
doc.select("div.name1,div.name2");
来源:https://stackoverflow.com/questions/24485013/or-operator-for-jsoup-select-method