This method validates and merges form data in the XML.