@Override
    public Iterator<? extends ParseTree> visitUserAgent(UserAgentContext ctx) {
        Iterator<? extends ParseTree>  children = getChildrenByName(ctx);
        if (children.hasNext()) {
            return children;
        }
        return visitChildren(ctx);
    }
This visitor will return the list of requested child nodes
analyzer/src/main/java/nl/basjes/parse/useragent/analyze/treewalker/steps/walk/stepdown/UserAgentGetChildrenVisitor.java