(这个问题与我之前在stackoverflow上发布的上一个问题有关......这是链接
使用 XPath、SAX 或 DOM 从 XML 文件中提取值用于此特定场景)
问题是,如果我想获得每个参与者在所有句子中写的单词,而不是获得句子,请记住上述情况。例如。如果“预算”一词总共使用了十次,参与者“Dolske”使用了七次,其他人使用了三次。所以我需要所有单词的列表以及每个参与者写了多少次?还有每回合的单词列表?
实现这一目标的最佳策略是什么?任何示例代码?
XML 附在此处(您也可以在引用的问题中查看)
“(495584)Firefox - 搜索建议传递错误的先前结果以形成历史记录”
<Turn>
<Date>'2009-06-14 18:55:25'</Date>
<From>'Justin Dolske'</From>
<Text>
<Sentence ID = "3.1"> Created an attachment (id=383211) [details] Patch v.2</Sentence>
<Sentence ID = "3.2"> Ah. So, there's a ._formHistoryResult in the....</Sentence>
<Sentence ID = "3.3"> The simple fix it to just discard the service's form history result.</Sentence>
<Sentence ID = "3.4"> Otherwise it's trying to use a old form history result that no longer applies for the search string.</Sentence>
</Text>
</Turn>
<Turn>
<Date>'2009-06-19 12:07:34'</Date>
<From>'Gavin Sharp'</From>
<Text>
<Sentence ID = "4.1"> (From update of attachment 383211 [details])</Sentence>
<Sentence ID = "4.2"> Perhaps we should rename one of them to _fhResult just to reduce confusion?</Sentence>
</Text>
</Turn>
<Turn>
<Date>'2009-06-19 13:17:56'</Date>
<From>'Justin Dolske'</From>
<Text>
<Sentence ID = "5.1"> (In reply to comment #3)</Sentence>
<Sentence ID = "5.2"> &gt; (From update of attachment 383211 [details] [details])</Sentence>
<Sentence ID = "5.3"> &gt; Perhaps we should rename one of them to _fhResult just to reduce confusion?</Sentence>
<Sentence ID = "5.4"> Good point.</Sentence>
<Sentence ID = "5.5"> I renamed the one in the wrapper to _formHistResult. </Sentence>
<Sentence ID = "5.6"> fhResult seemed maybe a bit too short.</Sentence>
</Text>
</Turn>
..... 等等
帮助将不胜感激...