I got a code for the parse method of Parser class in html parser library from the link
htmlparser.sourceforge.net/javadoc/index.html
the code is as follows
Expand|Select|Wrap|Line Numbers
- NodeList nl = parser.parse (null); // here is your two node list
- NodeList heads = nl.extractAllNodesThatMatch (new TagNameFilter ("HEAD"))
- if (heads.size () > 0) // there may not be a HEAD tag
- {
- Head head = heads.elementAt (0); // there should be only one
- head.removeAll (); // clean out the contents
- Tag title = new TitleTag ();
- title.setTagName ("title");
- title.setChildren (new NodeList (new TextNode ("The New Title")));
- Tag title_end = new TitleTag ();
- title_end.setTagName ("/title");
- title.setEndTag (title_end);
- head.add (title);
- }
- System.out.println (nl.toHtml ()); // output the modified HTML
"cannot find symbol class Head"
i couldnt find a class named Head in the library..
what should i do??