Move element recursion handling into a method.

This makes it easier to disable later on in the streaming parser.