diff --git a/lib/siplib.py b/lib/siplib.py index 71b7c184c5004408cb40ca7e3ec4b69b7e4da9c4..5e00931214463acee2ed213b8bfd2e2537365c7c 100644 --- a/lib/siplib.py +++ b/lib/siplib.py @@ -1488,16 +1488,17 @@ class Sip(object): raise Exception("This SIP does not describe a correlated dataproduct. No subarray pointing available.") # this will also validate the document so far - def get_prettyxml(self, schema_location:str = None): + def get_prettyxml(self): try: dom = self.__sip.toDOM() dom.documentElement.setAttribute("xmlns:xsi", "http://www.w3.org/2001/XMLSchema-instance") - if schema_location is None: - # this is/was the default schema location, even though we never hosted the xsd at the astron server - # That makes xmllint fail to validate (because the schema obviously can't be found) - schema_location = "http://www.astron.nl/SIP-Lofar LTA-SIP-2.7.2.xsd" + + # XML schema's have a weird way of using namespaces and locations.... + # search the internet, everybody thinks it's too complicated, + # and that it does not make sense that the schema_location/namespace should be URI's which can be URL's but are not mandated to actually serve the schema at that URL... + schema_location = "http://www.astron.nl/SIP-Lofar" dom.documentElement.setAttribute('xsi:schemaLocation', schema_location) - dom.documentElement.setAttribute('xmlns:sip', schema_location.split(' ')[0]) + dom.documentElement.setAttribute('xmlns:sip', schema_location) return dom.toprettyxml() except pyxb.ValidationError as err: logger.error(err.details())