Package org.jsoup.nodes

Examples of org.jsoup.nodes.Element.select()


    try {
      TeamData team = new TeamData();
      Element teamAElem = span.previousElementSibling();
      team.setName(teamAElem.textNodes().get(0).text());
      Element table = span.parent().nextElementSibling();
      Elements rows = table.select("tbody > tr");
      team.setRiders(new ArrayList<String>());
      for (int i = 0; i < rows.size(); i++) {
        Element riderAElem = rows.get(i).select("td:eq(1) > a").get(0);
        team.getRiders().add(riderAElem.textNodes().get(0).text());
      }
View Full Code Here


    while (eventsDivsIter.hasNext()) {
      EventSource eventSource = null;

      Element eventDiv = eventsDivsIter.next();
      if (eventDiv.select("div.teams").size() != 0) {
        // league event
        String homeTeam = extractTeam(eventDiv, "div.teams div.home a");
        String awayTeam = extractTeam(eventDiv, "div.teams div.away a");
        String eventUri = extractTeamEventUri(eventDiv);
        if (homeTeam != null && awayTeam != null && eventUri != null) {
View Full Code Here

        if (homeTeam != null && awayTeam != null && eventUri != null) {
          eventSource = new EventSource();
          eventSource.setEventName(homeTeam + " - " + awayTeam);
          eventSource.setEventUri("www.sportowefakty.pl" + eventUri);
        }
      } else if (eventDiv.select("div.single").size() != 0) {
        // single event
        Element a = eventDiv.select("div.single a").get(0);
        String eventName = a.text();
        String eventUri = a.attr("href");
        if (eventName != null && eventUri != null) {
View Full Code Here

    int errors = 0;
    BaseDao<IntEvent> dao = daoResolver.resolve(IntEvent.class);
    Elements trs = doc.select("tbody tr");
    for (int i = 0; i < 1; i++) {
      Element tr = trs.get(i);
      Elements tds = tr.select("td");

      String eventUri = tds.get(6).text();
      if (StringUtils.isNotBlank(eventUri)) {
        eventUri = eventUri.trim();
      } else {
View Full Code Here

            Object o1 = args[0];
            Object o2 = args[1];
            if (o1 != null && o1 instanceof Element) {
                Element e1 = (Element)o1;
                if(o2 != null && o2 instanceof String){
                    return e1.select(o2.toString());
                }
            }else{
                return new EvalError(ControlFunctionRegistry.getFunctionName(this) + " failed as the first parameter is not an HTML Element.  Please first use parseHtml(string)");
            }
        }
View Full Code Here

      Element postLink = post.select("a[href~="+ postNumberPattern.pattern() + "]:not("+post_content+" a)").last();
      postLink.setBaseUri(thread);
      String postURL = postLink.absUrl("href");

      final Element postContent = post.select(post_content).first();
      final Elements allBoldTagsInThisPost = postContent.select(bold_commands);

      // First poster is automatically granted GM permissions
      if (gms.isEmpty()) {
        addGM(poster);
      }
View Full Code Here

  public List<String> split(String content, String separatorCssSelector,
      JoinSeparator separatorStrategy) {

    Element body = parseContent(content);

    List<Element> separators = body.select(separatorCssSelector);
    if (separators.size() > 0) {
      List<List<Element>> partitions = split(separators, separatorStrategy, body);

      List<String> sectionHtml = new ArrayList<String>();
View Full Code Here

   */
  private List<Element> extractElements(String content, String selector, int amount) {

    Element body = parseContent(content);

    List<Element> elements = body.select(selector);
    if (elements.size() > 0) {

      elements = filterParents(elements);

      if (amount >= 0) {
View Full Code Here

   */
  public String setAttr(String content, String selector, String attributeKey, String value) {

    Element body = parseContent(content);
   
    List<Element> elements = body.select(selector);
    if (elements.size() > 0) {
     
      for (Element element : elements) {
        element.attr(attributeKey, value);
      }
View Full Code Here

   */
  public List<String> getAttr(String content, String selector, String attributeKey) {

    Element body = parseContent(content);
   
    List<Element> elements = body.select(selector);
    List<String> attrs = new ArrayList<String>();
   
    for (Element element : elements) {
      String attrValue = element.attr(attributeKey);
      attrs.add(attrValue);
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.