dom4j visitor pattern walk

  1. Preparation -- Use the walk method in the os.path module to list/print the names of the directories and files in a directory/sub-directory hierarchy.
  2. Use the dom4j visitor pattern support to visit all the nodes in an XML document.
  3. Print out a bit of information about each node, e.g. the node/tag name.
  4. Check the type of the node, and print out only information on specific node types, for example, only element nodes or only text nodes.
  5. Add a counter to your visitor. Initialize the counter in your visitor class constructor. Increment and display the counter with each node.

What you will learn:

Question: Can you find a difference or deficiency in the visitor pattern when used from Jython rather than Java? Hint: How would you visit only Element nodes?

Additional information: