def parseXmlFile(xmlFile, handler): """ Parses XML file by a given handler """ with contextlib.closing(StringIO(readCachedFileContent(xmlFile))) as stream: parse(stream, handler)