Initial merge of Diego's cleaned up XMLTree class.