Reputation: 53
i have a XML file in : /res/xml/countries.xml
and also i have a view with editText inside.
i want to search that text (users should type in editText) in my countries.xml file!
here is my xml file :
<?xml version="1.0" encoding="utf-8"?>
<countries>
<country>
<name>United State</name>
</country>
<countries>
Upvotes: 1
Views: 2581
Reputation: 2246
This tutorial explain clearly how to parse an XML file : XML parser
Other tutorial simpler with XPath : Xparse tutorial
Upvotes: 0
Reputation: 1102
If you want to read a whole document, use XML Parser
, like Pull already mentioned. If you only want to pick out only one or few certain things, I would suggest XPath
. Here is a good Tutorial on how to use XPath in Java.
Upvotes: 2
Reputation: 3585
Try this xpath tutorial... You will have good learning experience...
Upvotes: 0
Reputation: 3255
First you need to parse that xml file containing the countries name. Store list of countries in any arraylist and then write any search algo to search the text found from that edittext.
Upvotes: 0