在org.htmlparser
我想tbody
通过id
Parser htmlParser = Parser.createParser("<table id='_table' border='0' cellspacing='0' cellpadding='0' class='tableRegion' width='100%' ><thead><tr><td>1</td><td>2</td></tr></thead><tbody id='_table_body' ><tr><td>4</td><td>5</td></tr></tbody></table>","gbk");
NodeFilter filter = new HasAttributeFilter("id", "_table_body");
NodeFilter f = new AndFilter(new TagNameFilter("tr"), new HasParentFilter(filter));
NodeList nodelist1 = htmlParser.parse(filter); //Tag (144[0,144],173[0,173]): tbody id='_table_body'
NodeList nodelist2 = htmlParser.parse(f); //
为什么不nodelist1
读书<tr><td>4</td><td>5</td></tr>
?