命令:
xmllint myfile.xml--xpath'MapField2Data[@country=“FR”]/*[@active!=“false”or not(@active)]'
按预期工作
对于我的xml结构
但是
尝试在xsd中使用它,它无法编译:
xml棉绒
--loaddtd—noout—noent—xinclude
--模式
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中的一个bug或缺失的功能。
我应该为xmllint在gnome bugzilla上提交bug吗?
也许有
我问题的另一个解决方案
同时?
我希望“活动”标记是唯一的,并忽略像这样的结构中的非活动标记:
<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>
...
当做
伊曼纽尔。