The check should only be run when xml_flag == 1.