Package org.htmlparser.filters

Examples of org.htmlparser.filters.CssSelectorNodeFilter


 
  public static final String SWIMLANE_SEP = "__#Swimlane_Separator#__";
 
  protected Node getElementById(Parser parser, String id) {
    parser.reset();
    NodeFilter filter = new CssSelectorNodeFilter("#" + id);
    try {
      NodeList list = parser.extractAllNodesThatMatch(filter);
      if (list.size() > 0) {
        return list.elementAt(0);
      }
View Full Code Here


    public static final String SWIMLANE_SEP = "__#Swimlane_Separator#__";

    protected static Node getElementById(Parser parser, String id) {
        parser.reset();
        NodeFilter filter = new CssSelectorNodeFilter("#" + id);
        try {
            NodeList list = parser.extractAllNodesThatMatch(filter);
            if (list.size() > 0) {
                return list.elementAt(0);
            }
View Full Code Here

    public void testSelectors() throws Exception
    {
        String html = "<html><head><title>sample title</title></head><body inserterr=\"true\" yomama=\"false\"><h3 id=\"heading\">big </invalid>heading</h3><ul id=\"things\"><li><br word=\"broken\"/>&gt;moocow<li><applet/>doohickey<li class=\"last\"><b class=\"item\">final<br>item</b></ul></body></html>";
        Lexer l;
        Parser p;
        CssSelectorNodeFilter it;
        NodeIterator i;
        int count;

        l = new Lexer (html);
        p = new Parser (l);
        it = new CssSelectorNodeFilter ("li + li");
        count = 0;
        for (i = p.extractAllNodesThatMatch (it).elements (); i.hasMoreNodes ();)
        {
            assertEquals ("tag name wrong", "LI", ((Tag)i.nextNode()).getTagName());
            count++;
View Full Code Here

TOP

Related Classes of org.htmlparser.filters.CssSelectorNodeFilter

Copyright © 2018 www.massapicom. 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.