Added code to handle XML import from UI. Work in progress.
Improved error handling. Catch exceptions due to XML type mismatch.