Never try to export a file twice.

Changes behavior only for invalid content. Otherwise
it does not change behavior.
Refactor: Extract function: ds_sds_dump_component_sce.
Refactor: Extract function: ds_doc_from_foreign_node

Change the error messages along the way.