Move directory name uniquing to the Extractor class.

Also move string -> XML document kind to a function.