From: Christian Stork > > But in your particular example there is no subtyping at all, so there > > should be no problem anyway. > > I don't know which particular subtyping you refer to, but, of course, I > intend to subtype the rules and visitors. I should have looked at your code. Indeed you're using subtyping, but not on nodes, so it's ok. Yet I still don't understand what your code is about. I see nothing specific in your classes, justifying using object-orientation rather than normal variants. Also, the way you're coercing to an abstract rule, you're forgetting all useful information, to keep only the rule name. I don't see how you can make any useful use of that. Anyway, one can get rid at least part of the recursion, by restructuring your types in a more standard way: putting the common parts outside rather than inside. And why do you need your nodes to refer to their parent? When you walk the tree, it is clear who the parent is. Here is a slightly modified (more readable) version of your code, but I still don't see the point. What about having a look at a more functional view on DTD's, like in xmllight. http://tech.motion-twin.com/xmllight Jacques Garrigue