예제 #1
0
    def runTest(self):
        """Main entry point for the test suite"""
        from minixsv import pyxsval
        direc = config['instrumentDefinition.directory']
        self.xsdFile = os.path.join(direc, 'Schema/Grouping/1.0/',
                                    'GroupingSchema.xsd')
        files = self.__getDataFileList__()

        # run the tests
        failed = []
        for filename in files:
            try:
                print("----------------------------------------")
                print("Validating '%s'" % filename)
                pyxsval.parseAndValidateXmlInput(filename,
                                                 xsdFile=self.xsdFile,
                                                 validateSchema=0)
            except Exception as err:
                print("VALIDATION OF '%s' FAILED WITH ERROR:" % filename)
                print(err)
                failed.append(filename)

        # final say on whether or not it 'worked'
        print("----------------------------------------")
        if len(failed) != 0:
            print("SUMMARY OF FAILED FILES")
            for filename in failed:
                print(filename)
            raise RuntimeError("Failed Validation for %d of %d files" %
                               (len(failed), len(files)))
        else:
            print("Successfully Validated %d files" % len(files))
예제 #2
0
    def runTest(self):
        """Main entry point for the test suite"""
        from minixsv import pyxsval
        direc = config['instrumentDefinition.directory']
        filename = os.path.join(direc, 'Facilities.xml')
        xsdFile = os.path.join(direc, 'Schema/Facilities/1.0/',
                               'FacilitiesSchema.xsd')

        # run the tests
        failed = []
        try:
            print("----------------------------------------")
            print("Validating Facilities.xml")
            pyxsval.parseAndValidateXmlInput(filename,
                                             xsdFile=xsdFile,
                                             validateSchema=0)
        except Exception as e:
            print("VALIDATION OF Facilities.xml FAILED WITH ERROR:")
            print(e)
            failed.append(filename)

        # final say on whether or not it 'worked'
        print("----------------------------------------")
        if len(failed) != 0:
            print("SUMMARY OF FAILED FILES")
            raise RuntimeError("Failed Validation of Facilities.xml")
        else:
            print("Successfully Validated Facilities.xml")
    def runTest(self):
        """Main entry point for the test suite"""
        from minixsv import pyxsval # noqa
        direc = config['instrumentDefinition.directory']
        print(direc)
        self.xsdFile =  os.path.join(direc,'Schema/ParameterFile/1.0/','ParameterFileSchema.xsd')
        files = self.__getDataFileList__()

        # run the tests
        failed = []
        for filename in files:
            try:
                print("----------------------------------------")
                print("Validating '%s'" % filename)
                pyxsval.parseAndValidateXmlInput(filename, xsdFile=self.xsdFile, validateSchema=0)
            except Exception as e:
                print("VALIDATION OF '%s' FAILED WITH ERROR:" % filename)
                print(e)
                failed.append(filename)

        # final say on whether or not it 'worked'
        print("----------------------------------------")
        if len(failed) != 0:
            print("SUMMARY OF FAILED FILES")
            for filename in failed:
                print(filename)
            raise RuntimeError("Failed Validation for %d of %d files"
                               % (len(failed), len(files)))
        else:
            print("Successfully Validated %d files" % len(files))
    def runTest(self):
        """Main entry point for the test suite"""
        from minixsv import pyxsval
        direc = config['instrumentDefinition.directory']
        filename = os.path.join(direc,'Facilities.xml')
        xsdFile =  os.path.join(direc,'Schema/Facilities/1.0/','FacilitiesSchema.xsd')

        # run the tests
        failed = []
        try:
            print("----------------------------------------")
            print("Validating Facilities.xml")
            pyxsval.parseAndValidateXmlInput(filename, xsdFile=xsdFile, validateSchema=0)
        except Exception as e:
            print("VALIDATION OF Facilities.xml FAILED WITH ERROR:")
            print(e)
            failed.append(filename)

        # final say on whether or not it 'worked'
        print("----------------------------------------")
        if len(failed) != 0:
            print("SUMMARY OF FAILED FILES")
            raise RuntimeError("Failed Validation of Facilities.xml")
        else:
            print("Successfully Validated Facilities.xml")
    def runTest(self):
        """Main entry point for the test suite"""
        from minixsv import pyxsval
        direc = config['instrumentDefinition.directory']
        filename = os.path.join(direc,'Facilities.xml')
        xsdFile =  os.path.join(direc,'Schema/Facilities/1.0/','FacilitiesSchema.xsd')

        # run the tests
        failed = []
        try:
            print "----------------------------------------"
            print "Validating Facilities.xml"
            pyxsval.parseAndValidateXmlInput(filename, xsdFile=xsdFile, validateSchema=0)
        except Exception, e:
            print "VALIDATION OF Facilities.xml FAILED WITH ERROR:"
            print e
            failed.append(filename)
예제 #6
0
    def runTest(self):
        """Main entry point for the test suite"""
        from minixsv import pyxsval
        direc = config['instrumentDefinition.directory']
        self.xsdFile =  os.path.join(direc,'Schema/Grouping/1.0/','GroupingSchema.xsd')
        files = self.__getDataFileList__()

        # run the tests
        failed = []
        for filename in files:
            try:
                print "----------------------------------------"
                print "Validating '%s'" % filename
                pyxsval.parseAndValidateXmlInput(filename, xsdFile=self.xsdFile, validateSchema=0)
            except Exception, err:
                print "VALIDATION OF '%s' FAILED WITH ERROR:" % filename
                print err
                failed.append(filename)
    def runTest(self):
        """Main entry point for the test suite"""
        from genxmlif import GenXmlIfError
        from minixsv import pyxsval

        direc = config["instrumentDefinition.directory"]
        self.xsdFile = os.path.join(direc, "Schema/ParameterFile/1.0/", "ParameterFileSchema.xsd")
        files = self.__getDataFileList__()

        # run the tests
        failed = []
        for filename in files:
            try:
                print "----------------------------------------"
                print "Validating '%s'" % filename
                pyxsval.parseAndValidateXmlInput(filename, xsdFile=self.xsdFile, validateSchema=0)
            except Exception, e:
                print "VALIDATION OF '%s' FAILED WITH ERROR:" % filename
                print e
                failed.append(filename)
    def runTest(self):
        """Main entry point for the test suite"""
        from minixsv import pyxsval
        direc = config['instrumentDefinition.directory']
        self.xsdFile = os.path.join(direc, 'Schema/Grouping/1.0/',
                                    'GroupingSchema.xsd')
        files = self.__getDataFileList__()

        # run the tests
        failed = []
        for filename in files:
            try:
                print "----------------------------------------"
                print "Validating '%s'" % filename
                pyxsval.parseAndValidateXmlInput(filename,
                                                 xsdFile=self.xsdFile,
                                                 validateSchema=0)
            except Exception, err:
                print "VALIDATION OF '%s' FAILED WITH ERROR:" % filename
                print err
                failed.append(filename)
def check_imported_file(f_xml):
	local_xml_file = open('importXML.xml', 'w')
	local_xml_file.write(f_xml)
	local_xml_file.close()
	try:
		checkImport = xsv.parseAndValidateXmlInput(
		'importXML.xml',
		'importXML.xsd',
		xmlIfClass=xsv.XMLIF_ELEMENTTREE)
		ET = checkImport.getTree()
		root = ET.getroot()
	except xsv.XsvalError:
		return False
	return True
예제 #10
0
def validate(request, file):
    """
    file is the file imported
    validate is a helper method for uplaod that returns
    failure or success depending if the file given validates
    against the appropriate schema
    """
    try:
        elementTreeWrapper = pyxsval.parseAndValidateXmlInput(file, xsdFile='/u/tmtorres/CS373/cs373-wcdb/WCDB2.xsd.xml',
                             xmlIfClass=pyxsval.XMLIF_ELEMENTTREE)
        elemTree = elementTreeWrapper.getTree()
        root = elemTree.getroot()
        insert(root)
    except pyxsval.XsvalError, errstr:
        return render(request, 'utility.html', {'view': 'failure', 'errstr': errstr})