Add validate option to xml_loadbuf