metno / mmd

GNU General Public License v3.0
2 stars 11 forks source link

Issue185 invalid attributes #186

Closed mortenwh closed 2 years ago

mortenwh commented 2 years ago

@ferrighi - can you have a look? I'm not sure if we need to do anything in mmd.xsd as well. I guess we should, but there seems to be other issues as well. And should we also test other attributes?

ferrighi commented 2 years ago

I have some comments:

mortenwh commented 2 years ago

Thanks - tried to implement required for xml:lang as well but it doesn't seem to work. Could you have a look?

ferrighi commented 2 years ago

For the srsName you need, both the attribute to be required and non empty:

    <xs:attribute name="srsName" use="required">
       <xs:simpleType>
          <xs:restriction base="xs:string">
             <xs:minLength value="1"/>
          </xs:restriction>
       </xs:simpleType>
   </xs:attribute>

For the xml:lang, unfortunately I think you can only have it required, but you can't force the non empty string. This is because the xml:lang is defined by the xml schama (https://www.w3.org/TR/2012/REC-xmlschema11-2-20120405/datatypes.html#language) externally and the empty string is a valid entry. So I think we'll need to modify the mmd-to-geonorge.xslt in order to cover for a potential empty string. We'll then assume the strings are in English.

For the test, I think you need to push the precipitation_amount_st_92350_NO_LANG_ATTR.xml file

mortenwh commented 2 years ago

Thanks - it seems to work now, also for the missing xml:lang attribute :) So this is now only implemented in mmd_strict.xsd - should we also have it in mmd.xsd?