Test coverage enhancement and reference implementation for xml loader.

- Exceptions for basic types are now closer to bare python type cast errors (ValueError instead of TypeError).
- <reference> tag now works again as expected (may still need advanced testing).
- Adds tests and pragma no cover annotations.
- Adds a base TestCase class which logs to DEBUG level the test methods called.
- Removes unused test.