wmo-im / iwxxm

XML schema and Schematron for aviation weather data exchange
https://old.wmo.int/wiswiki/tiki-index.php%3Fpage=TT-AvXML
49 stars 22 forks source link

NSC rule in IWXXM 2.1 cannot be applied #88

Closed ilkkarinne closed 6 years ago

ilkkarinne commented 6 years ago

NSC in TAC-to-XML-Guidance.txt: https://github.com/wmo-im/iwxxm/blob/1543bfe7c526ce8498974f777361d89b958aeb92/2.1.1RC1/TAC-to-XML-Guidance.txt#L19

However, the iwxxm:cloud element may contain xsi:nil="true" attribute (Xerces validator):

Attribute 'http://www.w3.org/2001/XMLSchema-instance,nil' must not appear on element 'iwxxm:cloud', because the {nillable} property of 'iwxxm:cloud' is false.

blchoy commented 6 years ago

I don't understand, as we already have nillable="true" for iwxxm:cloud (Update: in metarSpeci.xsd):

<element nillable="true" name="cloud" minOccurs="0" maxOccurs="1">
    <complexType>
        <complexContent>
            <extension base="iwxxm:AerodromeObservedCloudsPropertyType">
                <attribute name="nilReason" type="gml:NilReasonType"/>
            </extension>
        </complexContent>
    </complexType>
</element>
ilkkarinne commented 6 years ago

Hi @blchoy: I don't know where the quoted element is, but I'm interesting in MeteorologicalAerodromeForecastRecordType at https://github.com/wmo-im/iwxxm/blob/0081cfa8b0d7607f7e50c7fbd5e209d11ecc220e/2.1.1RC1/taf.xsd#L121

blchoy commented 6 years ago

Oh, the iwxxm:cloud in taf.xsd! (I have modified my previous post to indicate the XSD file holding my iwxxm:cloud).

However, iwxxm:AerodromeCloudForecastType does not need xsi:nil="true" to make it empty. See #19 for details.

In IWXXM 3.0, we will include the use of xsi:nil="true" for all nillable items so that one do not need to switch from one syntax to another to make an element "nil".

braeckel commented 6 years ago

As a side note, IWXXM has two different nillable approaches. The MeasureTypes (such as airTemperature and verticalVisibility) inherit from MeasureType which have some required information, and in this case we must use xsi:nil to empty the contents due to the MeasureType's structure. For all other types the nilReason is more "native" and no xsi:nils are required.

I will take a look at the TAC-to-XML-Guidance.txt document and probably remove the "shall be nil" section from that guidance to reduce confusion.

The following validates for me (IWXXM 3):

<iwxxm:MeteorologicalAerodromeForecast gml:id="uuid.13048235-8f8a-4587-a6be-e8ce99f4525c" cloudAndVisibilityOK="false">
    <iwxxm:phenomenonTime xlink:href="#uuid.ed5d465f-51fb-4ecc-834a-2ee26bb1196f"/>
    <iwxxm:prevailingVisibility uom="m">9000</iwxxm:prevailingVisibility>
    <iwxxm:surfaceWind>
        <iwxxm:AerodromeSurfaceWindForecast variableWindDirection="false">
            <iwxxm:meanWindDirection uom="deg">130</iwxxm:meanWindDirection>
            <iwxxm:meanWindSpeed uom="m/s">5.0</iwxxm:meanWindSpeed>
        </iwxxm:AerodromeSurfaceWindForecast>
    </iwxxm:surfaceWind>
    <iwxxm:cloud nilReason="http://codes.wmo.int/common/nil/nothingOfOperationalSignificance"/>
</iwxxm:MeteorologicalAerodromeForecast>