Java Code Examples for org.jsoup.nodes.Element#removeClass()

The following examples show how to use org.jsoup.nodes.Element#removeClass() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: HtmlView.java    From JavaRushTasks with MIT License 5 votes vote down vote up
private String getUpdatedFileContent(List<Vacancy> vacancies) {

        Document document = null;
        try {
            document = getDocument();

            Element templateOriginal = document.getElementsByClass("template").first();
            Element copyTemplate = templateOriginal.clone();
            copyTemplate.removeAttr("style");
            copyTemplate.removeClass("template");
            document.select("tr[class=vacancy]").remove().not("tr[class=vacancy template");

            for (Vacancy vacancy : vacancies) {
                Element localClone = copyTemplate.clone();
                localClone.getElementsByClass("city").first().text(vacancy.getCity());
                localClone.getElementsByClass("companyName").first().text(vacancy.getCompanyName());
                localClone.getElementsByClass("salary").first().text(vacancy.getSalary());
                Element link =localClone.getElementsByTag("a").first();
                link.text(vacancy.getTitle());
                link.attr("href", vacancy.getUrl());

                templateOriginal.before(localClone.outerHtml());
            }
        } catch (IOException e) {
            e.printStackTrace();
            return "Some exception occurred";
        }
        return document.html();
    }
 
Example 2
Source File: Elements.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 Remove the class name from every matched element's {@code class} attribute, if present.
 @param className class name to remove
 @return this
 */
public Elements removeClass(String className) {
    for (Element element : this) {
        element.removeClass(className);
    }
    return this;
}
 
Example 3
Source File: Elements.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 Remove the class name from every matched element's {@code class} attribute, if present.
 @param className class name to remove
 @return this
 */
public Elements removeClass(String className) {
    for (Element element : this) {
        element.removeClass(className);
    }
    return this;
}
 
Example 4
Source File: Elements.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 Remove the class name from every matched element's {@code class} attribute, if present.
 @param className class name to remove
 @return this
 */
public Elements removeClass(String className) {
    for (Element element : this) {
        element.removeClass(className);
    }
    return this;
}
 
Example 5
Source File: Elements.java    From jsoup-learning with MIT License 5 votes vote down vote up
/**
 Remove the class name from every matched element's {@code class} attribute, if present.
 @param className class name to remove
 @return this
 */
public Elements removeClass(String className) {
    for (Element element : contents) {
        element.removeClass(className);
    }
    return this;
}