Java HTML Jsoup Document removeTag(Document doc, String selector)

Here you can find the source of removeTag(Document doc, String selector)

Description

remove Tag

License

Open Source License

Declaration

public static void removeTag(Document doc, String selector) 

Method Source Code

//package com.java2s;
/*******************************************************************************
 * Copyright (c) 2014,2015 Hideki Yatomi
 * All rights reserved. This program and the accompanying materials are made
 * available under the terms of the Eclipse Public License v1.0 which
 * accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 ******************************************************************************/

import org.jsoup.nodes.*;

public class Main {
    public static void removeTag(Document doc, String selector) {
        for (Element e : doc.select(selector).toArray(new Element[0])) {
            String text = e.text();
            e.after(text);/*from w  w w .ja  v  a  2 s  .  co m*/
            e.remove();
        }
    }
}

Related

  1. getTitleFromDocument(Document doc)
  2. keepLineBreak(Document docRes)
  3. makeAbsolute(Document doc)
  4. normalizeWhitespaces(Document doc)
  5. postDocument(String url, Collection data)
  6. retrieveHiddenInputs(Document doc)
  7. saveDocumentToDirectory(final org.jsoup.nodes.Document doc, final String fileName, final Path tmpDir)
  8. stripTags(Document document)
  9. verifyAdultNotice(Document doc)