added a terminal error when an XML document is found

also updated the spec and unit tests