Package us.codecraft.learning.select

Source Code of us.codecraft.learning.select.SelectorTest

package us.codecraft.learning.select;

import org.jsoup.nodes.Document;
import org.jsoup.parser.Parser;
import org.jsoup.select.Elements;

/**
* @author code4crafter@gmail.com
*/
public class SelectorTest {

    public static void main(String[] args) {
        String html = "<body>\n" +
                " <textarea>\n" +
                "        &lt;!-- Text --&gt;\n" +
                "        xxx\n" +
                "    </textarea> \n" +
                " <div> \n" +
                "  <table> \n" +
                "   <!-- InTable --> \n" +
                "   <!-- InTableText --> xxx \n" +
                "   <tbody> \n" +
                "    <tr> \n" +
                "     <!-- InRow --> \n" +
                "     <td> \n" +
                "      <!-- InCell --> </td> \n" +
                "    </tr> \n" +
                "   </tbody> \n" +
                "  </table> \n" +
                " </div> \n" +
                "</body>";
        Parser parser = Parser.htmlParser();
        Document document = parser.parseInput(html, "");
        Elements select = document.select("body div");
        System.out.println(select);
    }
}
TOP

Related Classes of us.codecraft.learning.select.SelectorTest

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.