Use the visitor pattern to visit namespace tree.