Parser parser = new Parser();
NodeFilter filterLink = new TagNameFilter (tag);
NodeList links = new NodeList ();
parser = createParserParsingAnInputString(output);
links = parser.extractAllNodesThatMatch(filterLink);
// loop to remove tags added recursively
// so if you have selected 'not recursive option'
// you have only the tag container and not the contained tags.
if (!recursive)