Joy - 2006-03-12

I just want to setLocation of a formtag in a html file, then output the html file.
But i got a NullPointerException in the sublist
How to solve this problem?
Thanks a lot~~~
The following is the code...

Parser myParser = new Parser(resource);
String filterStr = "form";
NodeFilter filter = new TagNameFilter(filterStr);
NodeList nodeList = myParser.parse(null);
NodeList subList = nodeList.extractAllNodesThatMatch(filter); /*When complie it, result: NullPointerException*/
FormTag formTag = (FormTag)subList.elementAt(0);
formTag.setFormLocation("\"myWebPage.htm\"");