Package org.jsoup.nodes

Examples of org.jsoup.nodes.Document


      String content = FileUtility.readToString(f,null);
      testHTMLExcelBridge(content);
    }
   
    private static void testHTMLExcelBridge(String content) throws Exception, ExcelException{
      Document doc = Jsoup.parseBodyFragment(content);
      Elements sheets = doc.select("table");
      HTMLExcelBridge heb = new HTMLExcelBridge(sheets);
      heb.reEvaluateAll();
      System.out.println(sheets.toString());
    }
View Full Code Here


    }
    return content.toString();
  }

  public void transformString(String channelString) {
    Document doc = Jsoup.parse(channelString);
    Elements tmp;
    tmp = doc.select("alias");
    if (tmp != null) {
      this.alias = (tmp.text());
    }
    tmp = doc.select("thumbImageUrl");
    if (tmp != null) {
      this.thumbImageUrl = (new Text(tmp.text()));
    }
    tmp = doc.select("title");
    if (tmp != null) {
      this.title = (new Text(tmp.text()));
    }
  }
View Full Code Here

//  }
 
  @Test
  public void testParseTables(){
    String tables = "<table><tr><td></td></tr></table>";
    Document doc = Jsoup.parseBodyFragment(tables);
    System.out.println(doc.toString());
  }
View Full Code Here

 
  @Test
  public void testParseSimpleHTML(){
    String html = "<html><head><title>First parse</title></head>"
        + "<body><p>Parsed HTML into a doc.</p></body></html>";
      Document doc = Jsoup.parse(html);
      assertTrue(doc!=null);
  }
View Full Code Here

    File body = new File(testFilePath,"table01.html");
    assumeThat(body.isFile(),is(true));
    assumeThat(body.canExecute(),is(true));
    String bodyHtml = loadHTMLFile(body);
    assumeThat(bodyHtml,notNullValue());
    Document doc = Jsoup.parseBodyFragment(bodyHtml);
    assertTrue(doc!=null);
   
   
    Elements sheets = doc.select("table");
    for(int si=0;si<sheets.size();si++){
      Element sheet = sheets.get(si);
      Elements rows = sheet.select("tbody tr");
      for(int ri=0;ri<rows.size();ri++){
        Element row = rows.get(ri);
View Full Code Here

    /**
     * @param args the command line arguments
     * @throws java.io.IOException
     */
    public static void main(String[] args) throws IOException {
        Document doc = Jsoup.connect("http://snooker.org/res/index.asp?event=268").get();
        for (Element event : doc.select("table#event thead")) {
            System.out.println(event.siblingIndex() + " : " + event.className() + " : " + event.html());
        }
    }
View Full Code Here

        }
    }

    private static ArrayList<Map<String, Object>> getEvents() throws IOException {
        ArrayList<Map<String, Object>> events = new ArrayList<>();
        Document doc = Jsoup.connect("http://snooker.org/res/index.asp?season=2013&template=2").get();
        for (Element event : doc.select("table#diary tbody tr")) {
            events.add(getEvent(event));
        }
        return events;
    }
View Full Code Here

   *
   * @param s
   *            the s
   */
  public void appendToHtml(String s) {
    Document doc = null;
    try {
      doc = Jsoup.parse(new File(getDefaultLogPath() + ".html"), "UTF-8");
    } catch (IOException e) {
    }
    Element body = doc.select("body").first();
    if (session == 0) {
      session = System.currentTimeMillis();
      body.appendElement("br");
      Element sess = new Element(Tag.valueOf("div"), "", new Attributes());
      sess.addClass("session");
      sess.attr("id", String.valueOf(session));
      sess.append("Session started on " + new java.util.Date());
      body.appendChild(sess);
      body.appendElement("br");
      if (s.equals("")) {
        saveLogFile(doc);
        return;
      }
    }
    Element cursession = doc.select("#" + session).first();
    if (cursession == null)
      return;

    Element timestamp = new Element(Tag.valueOf("span"), "",
        new Attributes());
View Full Code Here

import org.meb.speedway.process.model.TeamData;

public class SFLeagueEventParserV1 implements SFEventParser {

  public LeagueEventData parse(String content) {
    Document doc = Jsoup.parse(content);
    TeamData homeTeam = extractTeam(doc.select("span#bts_1").get(0));
    if (homeTeam == null) {
      return null;
    }
    TeamData awayTeam = extractTeam(doc.select("span#bts_2").get(0));
    if (awayTeam == null) {
      return null;
    }
    LeagueEventData event = new LeagueEventData();
    event.setHomeTeam(homeTeam);
View Full Code Here

  private static final Pattern pattern = Pattern
      .compile("(?i).*(wczoraj|dzisiaj|jutro|pojutrze).*([0-9]{2}):([0-9]{2}).*");

  @Override
  public List<EventSource> parse(String content) {
    Document doc = Jsoup.parse(content);
    Elements eventDivs = doc.select("div.event-page-card");
    ListIterator<Element> eventsDivsIter = eventDivs.listIterator();
    List<EventSource> eventSources = new ArrayList<EventSource>();

    while (eventsDivsIter.hasNext()) {
      EventSource eventSource = null;
View Full Code Here

TOP

Related Classes of org.jsoup.nodes.Document

Copyright © 2018 www.massapicom. 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.