0

NMatrix の Schematron を使用して、C# で XML を検証しようとしています。"f" 名前空間を名前空間マネージャー (nsManager) から除外すると、例外が発生します: Undeclared namespace prefix - f when this code is execute.

CompiledXPathExpression _expr;
...
_expr.SetContext(nsManager);

Schematron ラインの場合:

<sch:rule context="/f:Patient/f:identifier/f:period">

"f" 名前空間を追加した後、"rule" 行は完了し ますが、同じコードを実行すると、例外が発生します: Unrecognized extension function namespace: prefix='', namespace URI='' 。

CompiledXPathExpression _expr;
...
_expr.SetContext(nsManager);

次の Schematron 行の場合:

  <sch:assert test="not(exists(f:start)) or not(exists(f:end)) or (f:start/@value &lt;= f:end/@value)">Inv-1: If present, start SHALL have a lower value than end</sch:assert>

いくつかの実験の後、これが機能することがわかりました:

    <sch:rule context="/f:Patient/f:identifier/f:period">
      <sch:assert test="f:start">Inv-1: If present, start SHALL have a lower value than end</sch:assert>
   </sch:rule>

しかし、これは失敗します:

    <sch:rule context="/f:Patient/f:identifier/f:period">
      <sch:assert test="not(exists(f:start)) or not(exists(f:end)) or (f:start/@value &lt;= f:end/@value)">Inv-1: If present, start SHALL have a lower value than end</sch:assert>
end</sch:assert>
   </sch:rule>

最初は名前空間に何らかの問題があると思っていましたが、今ではこの構文が XPathExpression でも有効かどうか疑問に思い始めています。

4

1 に答える 1

0

これは学習体験でした!NMatrix-Schematron は完全に廃止されました。これはもはや機能しておらず、非常に古い Schematron 1.5 のみをサポートしています。

完全なデモンストレーションを見つけるのに非常に苦労しました。Saxon-HE を使用した完全なデモ ソリューションへのリンクを含めました。

サンプルコード

于 2014-04-02T19:44:04.630 に答える