I'm writing and Android application and I'm still learning how to search for string开发者_如何学JAVAs in XML files. Probably it can be done with XPath? (In fact, I also need to know how to load more than one file to make the queries)
What I'd like to know is if there's a way to use the Search Widget provided in the API linked with XPath queries. Is there a way to search for a string, for example, in my XML files, and present them within the Search Interface?
If I can't do that, please, I would like an idea of a good search interface for my XML files.
Thanks in advance!
I haven't used XPath on Android myself, I've only used the XmlPullParser. The Android documentation has a few pages on XPath:
- javax.xml.xpath package
- XPath
- "android xpath" on Google
On StackOverflow:
- Using XPath on String in Android (JAVA)
Please note that the XPath library was introduced in Android 2.2 with API level 8, so if you need to target older devices you need to use an alternative such as Xstream. http://x-stream.github.io/index.html
精彩评论