added error checking for valid numeric types, xml well-formedness and validity