gpt4 book ai didi

xml - 了解 schematron 验证

转载 作者:行者123 更新时间:2023-12-03 14:15:48 25 4
gpt4 key购买 nike

我是 xml 的新手,我很难理解以下语句中发生的事情。 Schematron 文件来自 https://schemas.wmo.int/iwxxm/3.0.0/rule/iwxxm.sch

<sch:rule context="//*[contains(name(),'MeteorologicalAerodromeTrendForecast')]/iwxxm:weather">
<sch:assert test="@xlink:href = document('codes.wmo.int-49-2-AerodromePresentOrForecastWeather.rdf')/rdf:RDF/*/skos:member/*/@*[local-name()='about'] or @nilReason">
MeteorologicalAerodromeTrendForecast iwxxm:weather elements should be a member of http://codes.wmo.int/49-2/AerodromePresentOrForecastWeather
</sch:assert>
</sch:rule>

我知道有一个规则来检查元素 iwxxm:weather ,但我无法理解测试条件。谁能给我解释一下?对于什么值,测试将通过。

测试在 xml 中的一行失败
<iwxxm:MeteorologicalAerodromeForecast gml:id="uuid.c42e9861-aed6-449f-b4cd-4789e96464d5" cloudAndVisibilityOK="false">
<iwxxm:prevailingVisibility uom="m">350</iwxxm:prevailingVisibility>
<iwxxm:surfaceWind>
<iwxxm:AerodromeSurfaceWindForecast variableWindDirection="false">
<iwxxm:meanWindDirection uom="deg">240</iwxxm:meanWindDirection>
<iwxxm:meanWindSpeed uom="[kn_i]">8</iwxxm:meanWindSpeed>
</iwxxm:AerodromeSurfaceWindForecast>
</iwxxm:surfaceWind>
Here ----> <iwxxm:weather xlink:href="http://codes.wmo.int/49-2/AerodromePresentOrForecastWeather/_RA"/>
<iwxxm:cloud>

谢谢

最佳答案

给定目标节点:

<iwxxm:weather xlink:href="http://codes.wmo.int/49-2/AerodromePresentOrForecastWeather/_RA"/>

和断言测试:
@xlink:href = document('codes.wmo.int-49-2-AerodromePresentOrForecastWeather.rdf')/rdf:RDF/*/skos:member/*/@*[local-name()='about'] or @nilReason

它比较 iwxxm:weather/@xlink:href 的值和 document('codes.wmo.int-49-2-AerodromePresentOrForecastWeather.rdf')/rdf:RDF/*/skos:member/*/@*[local-name()='about'] ,因为这是一个断言,如果比较值不匹配 OR iwxxm:weather 则返回 true没有属性 @nilReason .

如果 iwxxm:weather/@xlink:href 就会通过和 document('codes.wmo.int-49-2-AerodromePresentOrForecastWeather.rdf')/rdf:RDF/*/skos:member/*/@*[local-name()='about']是相等匹配或 iwxxm:weather应该有一个属性 @nilReason .

关于xml - 了解 schematron 验证,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60295523/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com