以下はサンプルの XML ファイルです。
<Docs>
<Doc>
<Name>Doc 1</Name>
<Info>Hurray</Info>
</Doc>
<Doc>
<Name>Doc 2</Name>
<Info>Brinjal is king of vegetables.</Info>
</Doc>
<Doc>
<Name>Doc 3</Name>
<Info>Alexandar was a great king. His desire was to conquer the world and rule the world as a king.</Info>
</Doc>
<Doc>
<Name>Doc 4</Name>
<Info>I love cherries.</Info>
</Doc>
<Doc>
<Name>Doc 5</Name>
<Info>Mango is king of fruits. Alphonso is king of mangoes. So Alphonso is king's king.</Info>
</Doc>
</Docs>
「王」という単語のタグを検索し、出力として返したいと思います。私はこれが簡単であることを知っています... :)
ただし、の順序は、検索された単語の順序にする必要があります (ここでは、王になります)。つまり、最も多くの数が最初に来ます。
Doc 5 (キングの 3 回) Doc 3 (キングの 2 回) Doc 2 (キングの 1 回)