/** @throws ParserException */ private void parseHtml() throws ParserException { htmlTags = new ArrayList(); Parser parser = new Parser(); parser.setInputHTML(fDocument.get()); for (NodeIterator e = parser.elements(); e.hasMoreNodes(); ) { Node node = e.nextNode(); VHtmlNodeVisitor htmlNodeVisitor = new VHtmlNodeVisitor(); node.accept(htmlNodeVisitor); } }
/** * Assign the underlying node filter for this wrapper. * * @param filter The filter to wrap. * @param context The parser to use for conditioning this filter. Some filters need contextual * information to provide to the user, i.e. for tag names or attribute names or values, so the * Parser context is provided. */ public void setNodeFilter(NodeFilter filter, Parser context) { Set set; mFilter = (TagNameFilter) filter; set = new HashSet(); context.reset(); try { for (NodeIterator iterator = context.elements(); iterator.hasMoreNodes(); ) addName(set, iterator.nextNode()); } catch (ParserException pe) { // oh well, we tried } for (Iterator iterator = set.iterator(); iterator.hasNext(); ) mName.addItem(iterator.next()); mName.setSelectedItem(mFilter.getName()); }