Package org.jsoup.nodes

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


    private Element makeShowHtml(String file, String title, String contents) {
        // create the pre tag
        Element pre = new Element(Tag.valueOf("pre"), "");
        pre.addClass("prettyprint source");
        pre.attr("style", "overflow-x:auto");
        List<Node> preChildren = new ArrayList<>();
        if (contents != null) {
            preChildren.add(new Element(Tag.valueOf("span"), "").appendText(contents));
        }
        ElementUtil.appendNodes(pre, preChildren);
View Full Code Here


    // @ShowCode:showPassvariablesEnd
    // @ShowCode:showDynamicsnippetStart
    public Renderer createDynamicSnippet() {
        Renderer render = new GoThroughRenderer();
        Element snippet = new SnippetNode("SimpleSnippet");
        snippet.attr("name", "Dynamic Snippet");
        render.add("div${symbol_pound}snippet", snippet);
        Element embed = new EmbedNode("/templates/embed/embedded.html");
        render.add("div${symbol_pound}embed", embed);
        return render;
    }
View Full Code Here

    private Element makeShowHtml(String file, String title, String contents) {
        // create the pre tag
        Element pre = new Element(Tag.valueOf("pre"), "");
        pre.addClass("prettyprint source");
        pre.attr("style", "overflow-x:auto");
        List<Node> preChildren = new ArrayList<>();
        if (contents != null) {
            preChildren.add(new Element(Tag.valueOf("span"), "").appendText(contents));
        }
        ElementUtil.appendNodes(pre, preChildren);
View Full Code Here

    // @ShowCode:showPassvariablesEnd
    // @ShowCode:showDynamicsnippetStart
    public Renderer createDynamicSnippet() {
        Renderer render = new GoThroughRenderer();
        Element snippet = new SnippetNode("SimpleSnippet");
        snippet.attr("name", "Dynamic Snippet");
        render.add("div${symbol_pound}snippet", snippet);
        Element embed = new EmbedNode("/templates/embed/embedded.html");
        render.add("div${symbol_pound}embed", embed);
        return render;
    }
View Full Code Here

            image_node.getLatch().countDown();
            return ;
        }
        Element image = (Element)image_node.getData();
        System.out.println(image.toString());
        String image_url =image.attr("src");
        image_url = image_url.replaceAll(" ", "%20");   
        try {
            getImage(image_url);
        } catch (IOException ex) {
            Logger.getLogger(ImageFetcher.class.getName()).log(Level.SEVERE, null, ex);
View Full Code Here

        Assertions.assertThat( actualLinks ).hasSize( expectedLinks.size() );

        for ( int i = 0; i < actualLinks.size(); i++ )
        {
            Element element = actualLinks.get( i );
            assertEquals( "Link[" + i + "]", expectedLinks.get( i ), element.attr( "href" ) );
        }
    }

}
View Full Code Here

    // @ShowCode:showPassvariablesEnd
    // @ShowCode:showDynamicsnippetStart
    public Renderer createDynamicSnippet() {
        Renderer render = new GoThroughRenderer();
        Element snippet = new SnippetNode("SimpleSnippet");
        snippet.attr("name", "Dynamic Snippet");
        render.add("div${symbol_pound}snippet", snippet);
        Element embed = new EmbedNode("/templates/embed/embedded.html");
        render.add("div${symbol_pound}embed", embed);
        return render;
    }
View Full Code Here

                  else  {
                    // construct a new widget chain for this text node
                    WidgetChain childsChildren = Chains.proceeding().addWidget(textWidget);
                   
                    // make a new widget for the annotation, making the text chain the child
                    String widgetName = child.attr(ANNOTATION_KEY).toLowerCase();
                    Renderable annotationWidget = registry.newWidget(widgetName, child.attr(ANNOTATION_CONTENT), childsChildren, pc.lexicalScopes.peek());
                    widgetChain.addWidget(annotationWidget);
                  }
                 
                } catch (ExpressionCompileException e) {
View Full Code Here

                    // construct a new widget chain for this text node
                    WidgetChain childsChildren = Chains.proceeding().addWidget(textWidget);
                   
                    // make a new widget for the annotation, making the text chain the child
                    String widgetName = child.attr(ANNOTATION_KEY).toLowerCase();
                    Renderable annotationWidget = registry.newWidget(widgetName, child.attr(ANNOTATION_CONTENT), childsChildren, pc.lexicalScopes.peek());
                    widgetChain.addWidget(annotationWidget);
                  }
                 
                } catch (ExpressionCompileException e) {
                    pc.errors.add(
View Full Code Here

        if (bestMatchElement != null) {
            List<ImageResult> images = new ArrayList<ImageResult>();
            Element imgEl = determineImageSource(bestMatchElement, images);
            if (imgEl != null) {
                res.setImageUrl(SHelper.replaceSpaces(imgEl.attr("src")));
                // TODO remove parent container of image if it is contained in bestMatchElement
                // to avoid image subtitles flooding in

                res.setImages(images);
            }
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.