-2
我DTD和XML:爲什麼我的xpath查詢不起作用?
<!DOCTYPE test [
<!ELEMENT team(owner+)>
<!ATTLIST team
name ID #REQUIRED
coach IDREF #REQUIRED
>
<!ELEMENT owner (#PCDATA)>
<!ELEMENT coach EMPTY>
<!ATTLIST coach
name ID #REQUIRED
>
<!ELEMENT game EMPTY>
<!ATTLIST game
teams IDREFS #REQUIRED
winner IDREF #REQUIRED
>
<!ELEMENT db (coach*,team*,match*)>
]>
<?xml version="1.0" ?>
<db>
<team name = "Hapoel" coach = "Abuksis">
<owner> Eli Tabib</owner>
</team>
<team name = "Maccabi" coach = "Blat">
<owner> Shimi</owner>
<owner> Federman</owner>
</team>
<team name = "Beitar" coach = "Eli Cohen">
<owner> Arkadi</owner>
</team>
<team name = "ElitzorLavi" coach = "Eli">
<owner> Zehava</owner>
<owner> Dani</owner>
</team>
<coach name = "Abuksis"/>
<coach name = "Eli Cohen"/>
<coach name = "Blat"/>
<coach name = "Eli"/>
<game teams = "Hapoel" winner = "Maccabi"/>
<game teams = "Hapoel Beitar" winner = "Beitar"/>
<game teams = "Maccabi ElitzorLavi" winner = "Maccabi"/>
<game teams = "Elitzor Lavi Maccabi" winner = "Maccabi"/>
</db>
我一定要找到比賽,使得球隊的數量是現在我希望能得到的只有第一場比賽。 我嘗試這個Xpath: db/game [count(/ @ teams)< 2] 但它給了我所有的遊戲.. 我的錯誤是什麼?
可能重複的[xpath - 爲什麼我的查詢不起作用?](http://stackoverflow.com/questions/16946344/xpath-why-my-query-does-not-works) –
相同的數據庫但其他查詢。需要幫助.. – user2456731
然後嘗試學習基本概念,這將幫助您遠遠超過想要某人爲您解決這個特定問題。就像「給男人一條魚/教一個人釣魚」的寓言。 –