我有一个 XML 文件:/res/xml/countries.xml
而且我还有一个内部有 editText 的 View 。
我想在我的 countries.xml 文件中搜索该文本(用户应输入 editText)!
这是我的 xml 文件:
<?xml version="1.0" encoding="utf-8"?>
<countries>
<country>
<name>United State</name>
</country>
<countries>
最佳答案
如果您想阅读整个文档,请使用 XML Parser
,例如 Pull已经提到了。如果您只想挑选出一个或几个特定的东西,我建议使用 XPath
。 Here is a good Tutorial on how to use XPath in Java.
关于java - android - 如何在 xml 文件中搜索,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20283586/