Added XML_ERROR to report improper XML and added some additional error logic into the parse function.