0
我有XML,我希望選擇具有minOccur =「1」的節點,但所有子節點都沒有這樣的屬性。XPATH:選擇具有特定屬性和子節點的節點沒有特定屬性
我XPATH:
//xnode[@type="parent" and @minOccurs="1" and ./child[not(@minOccurs)] and ./child[not(@or)] and ./not(ors) ]
XML:
<root>
<xnode type="parent" id="1" name="Date" maxOccurs="1" minOccurs="1">
<Othertags id="2" language="FR" name="Date"/>
<child id="3" name="dateone" maxOccurs="1" value="DONE">
<def id="4" language="EN" value="this is date one"/>
</child>
<child id="5" name="datetwo" maxOccurs="1" minOccurs="1" value="DTWO">
<def id="6" language="EN" value="this is date two"/>
</child>
</xnode>
<xnode type="parent" id="7" name="Time" maxOccurs="1" minOccurs="1">
<Othertags id="8" language="FR" name="time"/>
<child id="9" name="timeone" maxOccurs="1" value="TONE">
<def id="10" language="EN" value="this is time one"/>
</child>
<child id="11" name="timetwo" maxOccurs="1" value="TTWO">
<def id="12" language="EN" value="this is time two"/>
</child>
</xnode>
</root>
我預計只有第二點:ID = 「7」 返回,但事實證明,兩個節點返回。 XPath出了什麼問題?謝謝,
是的,輝煌! – dellair