Package org.jsoup.nodes

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


      }
      obj.setSource(source);

      // thumb image
      Elements elements = doc.select("img");
      String thumb = "/images/thumb.png";
      String ct = doc.select("body").html().trim();
      if (elements.size() > 0) {
        for (int i = 0; i < elements.size(); i++) {
          ct = ct.replace(elements.get(i).toString(),
View Full Code Here


      obj.setSource(source);

      // thumb image
      Elements elements = doc.select("img");
      String thumb = "/images/thumb.png";
      String ct = doc.select("body").html().trim();
      if (elements.size() > 0) {
        for (int i = 0; i < elements.size(); i++) {
          ct = ct.replace(elements.get(i).toString(),
              "<div class='image'>" + elements.get(i).toString()
                  + "</div>");
View Full Code Here

  public List<News> recoverListNews() {
    List<News> result = new ArrayList<News>();
    try {
      Document doc = Jsoup.parse(this.getStrListNews());
      Elements tmp;
      tmp = doc.select("news");
      for (Element element : tmp) {
        News obj = new News();
        obj.setAlias(element.select("alias").text());
        obj.setTitle(element.select("title").text());
        obj.setThumb(element.select("thumb").text());
View Full Code Here

                code = buffer.toString();
               
//              将html中table提取出来,html头部等信息都不要
                Document doc = Jsoup.parse(code);
            StringBuffer sb = new StringBuffer();
            Elements elements = doc.select("table");
            for(int i=0;i<elements.size();i++){
              Element element = elements.get(i);
              sb.append(element.toString());
            }
           
View Full Code Here

  public OperResult renderXLSV2(String id,String html,String time,String title,String mode,Map parameterMap){
//    System.out.println(html);
    OperResult result = new OperResult();
    if(html!=null){
      Document doc = Jsoup.parseBodyFragment(html);
      Elements tables = doc.select("table");
      Workbook book = HTMLAdjustMent4J.convertHTML2Excel(tables);
      if(book!=null){
        result.setSucceed();
        result.setData(book);
//        result.setInfoMSG("报表");
View Full Code Here

 
  public OperResult renderXLS(String id,String html,Map parameterMap) {
    OperResult result = new OperResult();
    if(html!=null){
      Document doc = Jsoup.parseBodyFragment(html);
      Elements tables = doc.select("table");
      List<Workbook> books = new ArrayList<Workbook>();
      for(int i=0;i<tables.size();i++){
        Element table = tables.get(i);
        Workbook book = HTMLAdjustMent4J.convertHTML2Excel(table.toString());
        if(book!=null){
View Full Code Here

    }
   
    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

  }
 
  public HTMLTableManipulator(String code){
    if(code!=null){
      Document document = Jsoup.parseBodyFragment(code);
      tables = document.select("table");
     
    }
  }

  public int getNumberOfSheets(){
View Full Code Here

          table.attr("title",sheet.getSheetName());
          ExcelUtility.convertSheet2HTMLTable(sheet, table);
        }
      }
      result.setSucceed();
      result.setData(doc.select("table").toString());
    } catch (Exception e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
      result.setFailed(e.getMessage());
    } finally{
View Full Code Here

      try {
//        byte[] html = doc.toString().getBytes("utf-8");
        ByteArrayOutputStream bos = new ByteArrayOutputStream();
//        DocumentConverter.convert(doc.toString().getBytes("utf-8"), "html", bos, "xls");
        Workbook wb = WorkbookFactory.create(new ByteArrayInputStream(bos.toByteArray()));
        Elements tableElements = doc.select("table");
        for(int i=0;i<tableElements.size();i++){
          Element table = tableElements.get(i);
          if(table.hasAttr("title")){
            if(wb.getNumberOfSheets()>i){
              wb.setSheetName(i, table.attr("title"));
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.