Java HTML Jsoup Element getTitle(Element el, String[] titles)

Here you can find the source of getTitle(Element el, String[] titles)

Description

get Title

License

Open Source License

Declaration

public static Element getTitle(Element el, String[] titles) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import org.jsoup.nodes.Element;

import org.jsoup.select.Elements;

public class Main {
    public static Element getTitle(Element el, String[] titles) {
        for (String title : titles)
            if (el.tagName().equals(title))
                return el;

        Elements subsectionTitles = new Elements();

        for (String title : titles)
            subsectionTitles.addAll(el.select(" " + title));

        //      if(subsectionTitles.size() != 1)
        //      {
        //         System.out.println("problem with title");
        //         return null;
        //      }
        //      else
        return subsectionTitles.get(0);
    }/*from  w ww .j a v  a 2 s .  c  o m*/
}

Related

  1. getTextContent(Element node)
  2. getTextFromAClass(Element doc, String location)
  3. getTextFromMultipleSelect(Element doc, String location, String locationValue)
  4. getTextFromNodeIfAvailable(Element doc)
  5. getTextFromNodeSelect(Element doc, String location, String locationValue)
  6. getUserId(Element authorElement)
  7. isChildOf(Element child, Elements possibleParents)
  8. isEmptyElement(Node node)
  9. markAll(Elements tags)