Completed XML parser that passes the unit test