Menu

#270 reset() then exception

open
nobody
5
2009-02-11
2009-02-11
No

I'm not really sure if this is expected behaivor or not.
The following code throws IllegalArgumentException "attempt to extract future characters from source"

Parser parse = new Parser(filename);
NodeList list = parse.extractAllNodesThatMatch(filter);
parse.reset();
System.out.println(list.elementAt(0).toHtml(true));

Assuming the Tag at 0 has attributes. Upon investigation it seems that when attributes are checked it checks the offset and since reset makes the offset = 0 the exception is thrown.
However this doesn't happen if the tag doesn't have attributes it throws no errors. I would figure it should be one or the other.

Discussion


Log in to post a comment.