Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

#296 Filter NOT, NOT (pred OR pred) does not work

v2.0
open
nobody
None
5
2013-07-03
2013-07-03
No
private NodeFilter filter = null;
    filter = new NotFilter(new OrFilter(
            new TagNameFilter[] {
                    new TagNameFilter("DOCTYPE"),
                    new TagNameFilter("!DOCTYPE"),
                    new TagNameFilter("script"),
            }
            ));
    NodeList nl = parser.parse(filter).extractAllNodesThatMatch(filter);
    nl.visitAllNodesWith(new NodeVisitor() {

        @Override
        public void beginParsing() {
        }

        @Override
        public void finishedParsing() {
        }

        @Override
        public void visitTag(Tag tag) {
            TagDescriptor tagDescriptor = getDescriptor(tag);
            if (!tag.isEndTag() && !tag.isEmptyXmlTag() && tag.getEndTag() != null) {
                System.out.printf("<%s>%n", tag.getTagName());
        }

        @Override
        public void visitEndTag(Tag tag) {
            TagDescriptor tagDescriptor = getDescriptor(tag);
            System.out.printf("</%s>%n", tag.getTagName());
        }
    });

/
After this lines being run, I see all tags on stdout. None was filtered. It looks like parse(filter) and extractAllNodesThatMatch(filter) doesn't work at all. No filter applied
/

Discussion