Skip to content
Snippets Groups Projects
Select Git revision
  • 55adcbead99828991697b04bd2f968a86f8c8146
  • master default protected
  • control-single-hba-and-lba
  • stabilise-landing-page
  • all-stations-lofar2
  • L2SS-2357-fix-ruff
  • v0.39.7-backports
  • Move-sdptr-to-v1.5.0
  • fix-build-ubuntu
  • tokens-in-env-files
  • fix-build
  • L2SS-2214-deploy-cdb
  • fix-missing-init
  • add-power-hardware-apply
  • L2SS-2129-Add-Subrack-Routine
  • Also-listen-internal-to-rpc
  • fix-build-dind
  • L2SS-2153--Improve-Error-Handling
  • L2SS-2153-Add-Grpc-Gateway-support
  • L2SS-1970-apsct-lol
  • DNM-pytango10.0.1rc1-test
  • remove-snmp-client
  • v0.52.3 protected
  • v0.52.3dev0 protected
  • 0.53.1dev0
  • v0.52.2-rc3 protected
  • v0.52.2-rc2 protected
  • v0.52.2-rc1 protected
  • v0.52.1.1 protected
  • v0.52.1 protected
  • v0.52.1-rc1 protected
  • v0.51.9-6 protected
  • v0.51.9-5 protected
  • v0.51.9-4 protected
  • v0.51.9-3 protected
  • v0.51.9-2 protected
  • v0.51.9-1 protected
  • v0.51.9 protected
  • v0.51.8 protected
  • v0.39.15-wsrttwo protected
  • v0.39.15-wsrt protected
41 results

01-devices.py

Blame
  • Code owners
    Assign users and groups as approvers for specific file changes. Learn more.
    validator.py 910 B
    
    from lxml import etree
    
    def validate(xmlpath, xsdpath):
        '''validates given xml file against given xsd file'''
        with open(xsdpath) as xsd:
            xmlschema_doc = etree.parse(xsd)
            xmlschema = etree.XMLSchema(xmlschema_doc)
    
            with open(xmlpath) as xml:
                doc = etree.parse(xml)
                valid = xmlschema.validate(doc)
    
                if not valid:
                    try:
                        xmlschema.assertValid(doc)
                    except Exception as err:
                        print err
    
                return valid
    
    #expose a main method in this lib module which can be used by external programs
    #or by the bin/validatesip 'program'
    def main(argv):
        #do the proper calls to the SIP API
        # parse cmdline args etc
        try:
            xml = argv[0]
            xsd = argv[1]
            validate(xml, xsd)
        except Exception as err:
            print "An error occurred:"
            print err