First, you need to create a new instance of a XmlReader object, then you’ll try to open the .xml file, if the file can’t be opened a error message will be displayed.