コマンド:
xmllint myfile.xml --xpath 'MapField2Data[@country="FR"]/*[@active!="false" or not(@active) ]'は、私の xml 構造に対して
期待どおりに機能します。
しかし、xsd で使用しようとすると、コンパイルに失敗します。
xmllint --loaddtd --noout --noent --xinclude --schema xsd/pnsConf.xsd pnsConf.xml
xsd/pnsConf.xsd:75: 要素セレクター: スキーマ パーサー エラー: 要素 '{ http://www.w3. org/2001/XMLSchema }selector'、属性 'xpath': XPath 式 'MapField2Data[@country="FR"]/*[@active!="false" or not(@active) ]' をコンパイルできませんでした。
私のxsdには適切な
<xsd:selector xpath='MapField2Data[@country="FR"]/*[@active!="false" or not(@active) ]'/>
「MapField2Data/*」のような単純な xpath は、どちらの状況でも問題なく機能します。
これは、xmllint または libxml2 のバグまたは欠落している機能のようです。
xmllint の gnome bugzilla にバグを報告する必要がありますか?
それまでの間、私の問題に対する別の解決策があるでしょうか?
「アクティブな」タグを一意にして、次のような構造の非アクティブなタグを無視したい:
<MapField2Data country='FR' >
<raw id='NoUnReadMails' active='true'>
<depend ref='_EndMailNotif'/>
<depend ref='_EndMailSub' />
</raw>
<raw id='NoUnReadMails' active='false'>
<depend ref='_EndMailNotif'/>
<depend ref='_EndMailSub' />
</raw>
<raw id='NoEMails' >
<depend ref='_EndMailNotif'/>
<depend ref='_EndMailSub' />
</raw>
...
よろしく、エマニュエル。