Code cleanup of ElementTree adapter implementations.

Removed unused/redundant code, fixed incorrectly-scoped ancestry caching
mechanism, improved test coverage