Added unit tests for the XML loader and fixed a bug where the xml loader
wasn't setting up rules with substitutions correctly.