Example #1
0
def validate(filename, inspire_tg=True, expected_gmljp2=True, oidoc=None):

    try:
        os.stat('tmp/cache/SCHEMAS_OPENGIS_NET')
        ogc_schemas_location = 'tmp/cache/SCHEMAS_OPENGIS_NET'
    except OSError:
        ogc_schemas_location = 'disabled'

    if ogc_schemas_location != 'disabled':
        try:
            import xmlvalidate
            xmlvalidate.validate  # to make pyflakes happy
        except (ImportError, AttributeError):
            ogc_schemas_location = 'disabled'

    path = '../../gdal/swig/python/samples'
    if path not in sys.path:
        sys.path.append(path)

    import validate_jp2
    error_report = validate_jp2.ErrorReport(collect_internally=True)
    return validate_jp2.validate(filename,
                                 oidoc,
                                 inspire_tg,
                                 expected_gmljp2,
                                 ogc_schemas_location,
                                 error_report=error_report)
Example #2
0
def validate(filename, inspire_tg=True, expected_gmljp2=True, oidoc=None):

    try:
        os.stat('tmp/cache/SCHEMAS_OPENGIS_NET')
        ogc_schemas_location = 'tmp/cache/SCHEMAS_OPENGIS_NET'
    except:
        ogc_schemas_location = 'disabled'

    if ogc_schemas_location != 'disabled':
        try:
            import xmlvalidate
            xmlvalidate.validate  # to make pyflakes happy
        except:
            ogc_schemas_location = 'disabled'

    import validate_jp2
    error_report = validate_jp2.ErrorReport(collect_internally=True)
    return validate_jp2.validate(filename, oidoc, inspire_tg, expected_gmljp2, ogc_schemas_location, error_report=error_report)