diff --git a/bin/validatesip b/bin/validatesip index 079c597e43f946b02bf4751efc9bd27b5f3a673c..d12bf5e7c6589adcbc58ea7fe234b3118f936fea 100755 --- a/bin/validatesip +++ b/bin/validatesip @@ -5,7 +5,8 @@ from lofar.lta.sip.validator import main def parse_args(): parser = ArgumentParser(description='validates sip over the xsd') - parser.add_argument('sip', help='xml sip to validate') + parser.add_argument('--sip', nargs='?', default='', help='xml SIP file to validate') + parser.add_argument('--xsd', nargs='?', default=None, help='Alternative xsd schema file for validation') return parser.parse_args() diff --git a/lib/validator.py b/lib/validator.py index 98f0acff322960cd9c7f1ddb7abe164899901cb1..16322d380d59997020ee98aa57a94473773841b9 100644 --- a/lib/validator.py +++ b/lib/validator.py @@ -109,14 +109,17 @@ def check_consistency_of_file(xmlpath): return check_consistency(sip) -def main(xml): +def main(xml, xsd_file): """ validates given xml against the SIP XSD and does consistency check """ try: xml = xml - xsd = DEFAULT_SIP_XSD_PATH + if xsd_file is None: + xsd = DEFAULT_SIP_XSD_PATH + else: + xsd = xsd_file valid = validate(xml, xsd) consistent = check_consistency_of_file(xml) return valid and consistent