use of org.jsoup.select.Elements in project Asqatasun by Asqatasun.
the class Aw22Rule05081 method extractTableWithDataTableMarkup.
/**
*
* @param sspHandler
* @param elementHandler
* @param elementHandlerWithoutDataTableMarkup
*/
private void extractTableWithDataTableMarkup(ElementHandler<Element> elementHandler, ElementHandler<Element> elementHandlerWithoutDataTableMarkup) {
Elements elementsWithMarkup = new Elements();
for (Element el : elementHandler.get()) {
if (el.select(DATA_TABLE_MARKUP_CSS_LIKE_QUERY).size() > 0) {
elementsWithMarkup.add(el);
} else if (elementHandlerWithoutDataTableMarkup != null) {
elementHandlerWithoutDataTableMarkup.add(el);
}
}
elementHandler.clean().addAll(elementsWithMarkup);
}
use of org.jsoup.select.Elements in project Asqatasun by Asqatasun.
the class PathElementBuilderTest method testBuildTextFromElement.
/**
* Test of buildTextFromElement method, of class PathElementBuilder.
*/
public void testBuildTextFromElement() throws IOException {
LOGGER.info("buildTextFromElement");
Document document = Jsoup.parse(FileUtils.readFileToString(new File("src/test/resources/pathBuilder/test1.html")));
Element el = document.select("footer").first();
PathElementBuilder instance = new PathElementBuilder(true);
String result = instance.buildTextFromElement(el);
LOGGER.debug("result = " + result);
Elements elementsFromBuiltPath = document.select(result);
assertEquals(1, elementsFromBuiltPath.size());
assertEquals(el, elementsFromBuiltPath.first());
}
use of org.jsoup.select.Elements in project Asqatasun by Asqatasun.
the class Rgaa30Rule050501 method select.
@Override
protected void select(SSPHandler sspHandler) {
super.select(sspHandler);
// once tables selected, we extract the caption child element of each
// to make the control
Elements captionOnTable = new Elements();
for (Element el : getSelectionWithoutMarkerHandler().get()) {
captionOnTable.add(el.select(CAPTION_ELEMENT).first());
}
getSelectionWithoutMarkerHandler().clean().addAll(captionOnTable);
Elements captionOnDataTable = new Elements();
for (Element el : getSelectionWithMarkerHandler().get()) {
captionOnDataTable.add(el.select(CAPTION_ELEMENT).first());
}
getSelectionWithMarkerHandler().clean().addAll(captionOnDataTable);
}
use of org.jsoup.select.Elements in project Asqatasun by Asqatasun.
the class Rgaa32016Rule050201 method select.
@Override
protected void select(SSPHandler sspHandler) {
super.select(sspHandler);
// once tables selected, we extract the caption child element of each
// to make the control
Elements captionOnTable = new Elements();
for (Element el : getSelectionWithoutMarkerHandler().get()) {
captionOnTable.add(el.select(CAPTION_ELEMENT).first());
}
getSelectionWithoutMarkerHandler().clean().addAll(captionOnTable);
Elements captionOnDataTable = new Elements();
for (Element el : getSelectionWithMarkerHandler().get()) {
captionOnDataTable.add(el.select(CAPTION_ELEMENT).first());
}
getSelectionWithMarkerHandler().clean().addAll(captionOnDataTable);
}
use of org.jsoup.select.Elements in project AndroidDevelop by 7449.
the class JsoupTool method getDetail.
public DetailModel getDetail(String url) {
Document document = getDocument(url);
DetailModel detailModel = new DetailModel();
if (document == null) {
throw new NullPointerException("the document is null");
}
Elements select = document.select("div.bottem2").select("a[href$=.html]");
for (int i = 0; i < select.size(); i++) {
switch(i) {
case 0:
detailModel.setOnPage(select.get(i).attr("abs:href"));
break;
case 1:
detailModel.setNextPage(select.get(i).attr("abs:href"));
break;
}
}
detailModel.setTitle(document.select("div.bookname").select("h1").text());
detailModel.setContent(document.select("#content").html());
KLog.i(detailModel.getOnPage() + " " + detailModel.getNextPage());
return detailModel;
}
Aggregations