def validate(self):
         
        # clear any previous xml errors
        clear_error_log()
        if self.schemafile is not None:
            try:
                # Attempt parsing the schema file
                schdoc = parse(self.schemafile)
            except XMLSyntaxError, e:
                # The schema was not parsable XML
                logging.warning('The schema XML file could not be parsed.')
                for item in e.error_log:
                    logging.info(item)

                return False

            try:
                theschema = XMLSchema(schdoc)
            except XMLSchemaParseError, e:
                # The schema document is XML, but it's not a schema
                logging.warning('The schema XML file was parsed, but it does not appear to be a valid XML Schema document.')
                for item in e.error_log:
                    logging.info(item)

                return False

        try:
            # Attempt parsing the data file
            thedata = parse(self.datafile)
        except XMLSyntaxError, e:
            # The data was not parsable XML
            logging.warning('The data XML file could not be parsed.')
            for item in e.error_log:
                logging.info(item)

            return False

        if self.schemafile is not None:
            if theschema.validate(thedata):
                self.data = thedata
                return True

            logging.warning('The data does not conform to the provided schema.')
            for item in theschema.error_log:
                logging.info(item)

            return False

        self.data = thedata

        return True
Validate the provided data file for correctness against the provided
dataset/ETHPy150Open PublicMapping/DistrictBuilder/django/publicmapping/redistricting/__init__.py/StoredConfig.validate