Added getXmlElement and checking for opening a file