Minor refactorings in DOMImporter.
Minor refactorings in DOMImporter.

Needed for testing.

substance/substance,andene/substance,podviaznikov/substance,michael/substance-1,stencila/substance,substance/substance,podviaznikov/substance,andene/substance,michael/substance-1