Package org.jsoup.nodes

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


    Element body = parseContent(content);

    List<String> headIds = concat(HEADINGS, "[id]", true);

    // select all headings that have an ID
    List<Element> headings = body.select(StringUtil.join(headIds, ", "));

    List<HeadingItem> headingItems = new ArrayList<HeadingItem>();
    for (Element heading : headings) {
      headingItems.add(new HeadingItem(heading.id(), heading.text(), headingIndex(heading)));
    }
View Full Code Here


    if (docOrElement instanceof DocumentWrapper) {
      el = ((DocumentWrapper) docOrElement).doc;
    } else {
      el = ((ElementWrapper) docOrElement).el;
    }
    final Elements elements = el.select(selectStatement);

    if (elements.size() == 1)
      return ParseResult.success(tokens.replaceWithTokens(templatePos, templatePos+template.size(), new ElementWrapper(elements.first())));
    else {
      final List<Object> elementList = Lists.newArrayListWithCapacity(elements.size());
View Full Code Here

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

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

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

        for ( Iterator<Element> elementIterator = links.iterator(); elementIterator.hasNext(); )
        {
            Element link = elementIterator.next();
            link.attr( "href", "#" + startPath + "/" + link.attr( "href" ) );
View Full Code Here

   */
  protected void saveLinFromMovie(Element elemLin, File outFile)
    throws DownloadFailedException, java.io.IOException
  {
    Element td = elemLin.parent();
    Elements elems = td.select("a:matches(Movie)");
    if (elems.size() == 0)
      throw new DownloadFailedException(PbnTools.getStr("error.noMovie",
        td.html()), m_ow, false);
    Element movieElem = elems.get(0);
    String sOnClick = movieElem.attr("onclick");
View Full Code Here

    Element e = this.doc.select("li#button" + item + " div div").first();
    if (e == null) {
      System.out.println("unknown item");
      return;
    }
    String name = e.select("span.textlabel").first().text().trim();
    Element i = e.select("a.fastBuild").first();
    if (i == null) {
      System.out.println("Cannot build '" + name
          + "', adding on queue pos." + this.buildQueue.size()+1);
      BuildItem t = new BuildItem();
View Full Code Here

    @Test public void testSupportsLeadingCombinator() {
        String h = "<div><p><span>One</span><span>Two</span></p></div>";
        Document doc = Jsoup.parse(h);

        Element p = doc.select("div > p").first();
        Elements spans = p.select("> span");
        assertEquals(2, spans.size());
        assertEquals("One", spans.first().text());

        // make sure doesn't get nested
        h = "<div id=1><div id=2><div id=3></div></div></div>";
View Full Code Here

    @Test public void testSupportsLeadingCombinator() {
        String h = "<div><p><span>One</span><span>Two</span></p></div>";
        Document doc = Jsoup.parse(h);

        Element p = doc.select("div > p").first();
        Elements spans = p.select("> span");
        assertEquals(2, spans.size());
        assertEquals("One", spans.first().text());

        // make sure doesn't get nested
        h = "<div id=1><div id=2><div id=3></div></div></div>";
View Full Code Here

  public CriTableMap get() {
    Map<String, CriMap> map = newHashMap();

    Element miolo = doc.getElementById("DivMiolo");
    Elements ps = miolo.select("p.txtSubtit");

    for (Element p : ps) {
      String key = p.text();
      Element table = p.nextElementSibling();
      CriMap value = new CriMapGen(table).get();
View Full Code Here

        Elements rows = table.select("> tbody > tr");
        if (rows.size() > 0)
        {
            Element firstRow = rows.get(0);
            buildSpecFromRow(firstRow.select("> td"), specs);
            rowIndex++;
        }

        if (specs.isEmpty() && rows.size() > 1)
        {
View Full Code Here

        }

        if (specs.isEmpty() && rows.size() > 1)
        {
            Element secondRow = rows.get(1);
            buildSpecFromRow(secondRow.select("> td"), specs);
            rowIndex++;
        }

        return rowIndex;
    }
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.