Implementation and use of Domain::extractelement.

Fixes #155.