Package org.jsoup.nodes

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


            Document document = Document.createShell("");
            BootstrapPageResponse pageResponse = new BootstrapPageResponse(
                    this, request, context.getSession(), context.getUIClass(),
                    document, headers, fragmentResponse.getUIProvider());
            List<Node> fragmentNodes = fragmentResponse.getFragmentNodes();
            Element body = document.body();
            for (Node node : fragmentNodes) {
                body.appendChild(node);
            }

            setupStandaloneDocument(context, pageResponse);
View Full Code Here


            head.appendElement("link").attr("rel", "icon")
                    .attr("type", "image/vnd.microsoft.icon")
                    .attr("href", themeUri + "/favicon.ico");
        }

        Element body = document.body();
        body.attr("scroll", "auto");
        body.addClass(ApplicationConstants.GENERATED_BODY_CLASSNAME);
    }

    protected String getMainDivStyle(BootstrapContext context) {
View Full Code Here

        try {
            doc = Jsoup.connect(url).get();
        } catch (IOException e) {
            e.printStackTrace();
        }
        return doc.body().html().trim();
    }

    public static void main(String[] args) {
        System.out.println(GDocParser.onSupport1());
    }
View Full Code Here

        String startPath = StringUtils.substringBefore( path, "/" );

        // replace all links !!
        Document document = Jsoup.parse( is, "UTF-8", "" );

        Element body = document.body().child( 0 );

        Elements links = body.select( "a[href]" );

        for ( Element link : links ) {
            link.attr( "href", "#" + startPath + "/" + link.attr( "href" ) );
View Full Code Here

    InputStream in = null;
    try {
      in = new FileInputStream(file1);
      Workbook book = WorkbookFactory.create(in);
      Document doc = Jsoup.parse("");
      Element body = doc.body();
      for(int i=0;i<book.getNumberOfSheets();i++){
        Sheet sheet = book.getSheetAt(i);
        if(!ExcelUtility.isEmptySheet(sheet)){
          Element table = body.appendElement("table");
          table.attr("title",sheet.getSheetName());
View Full Code Here

     */
    public static String clean(String bodyHtml, String baseUri, Whitelist whitelist) {
        Document dirty = parseBodyFragment(bodyHtml, baseUri);
        Cleaner cleaner = new Cleaner(whitelist);
        Document clean = cleaner.clean(dirty);
        return clean.body().html();
    }

    /**
     Get safe HTML from untrusted input HTML, by parsing input HTML and filtering it through a white-list of permitted
     tags and attributes.
View Full Code Here

     *
     * @return Document, with empty head, and HTML parsed into body
     */
    public static Document parseBodyFragment(String bodyHtml, String baseUri) {
        Document doc = Document.createShell(baseUri);
        Element body = doc.body();
        List<Node> nodeList = parseFragment(bodyHtml, body, baseUri);
        Node[] nodes = nodeList.toArray(new Node[nodeList.size()]); // the node list gets modified when re-parented
        for (Node node : nodes) {
            body.appendChild(node);
        }
View Full Code Here

                if( contentType.equals(MediaType.APPLICATION_XML) ) {
                    exceptionResponse = deserializeResponseContent(content, JaxbExceptionResponse.class);
                } else if( contentType.startsWith(MediaType.TEXT_HTML) ) {
                    exceptionResponse = new JaxbExceptionResponse();
                    Document doc = Jsoup.parse(content);
                    String body = doc.body().text();
                    exceptionResponse.setMessage(body);
                    exceptionResponse.setUrl(httpRequest.getUri().toString());
                    exceptionResponse.setStackTrace("");
                }
                else {
View Full Code Here

  }

  protected String clean(String input, Cleaner cleaner) {
    Document unsafe = Jsoup.parse(input);
    Document safe = cleaner.clean(unsafe);
    return safe.body().html();
  }

  /**
   * Builds & returns a loose HTML whitelist similar to Github.
   *
 
View Full Code Here

   * @return the {@code body} element of the parsed content
   */
  private Element parseContent(String content) {
    Document doc = Jsoup.parseBodyFragment(content);
    doc.outputSettings().charset(outputEncoding);
    return doc.body();
  }
 
  /**
   * Retrieves attribute value on elements in HTML. Will return all attribute values for the
   * selector, since there can be more than one element.
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.