abcd1234 abcd1234 - 6 months ago 42
Android Question

android get data from xml to string

i have xml file store in sdcard like this :

<emp id="1" sex="male">
<emp id="2" sex="female">
<emp id="3" sex="male">
<emp id="4" sex="male">

I want convert it to string.

like String str = "xml data".

how to do that?


You need to open it with an XML document reader if you want the semantic content, but if you just want to read the string from a file then you just need a file reader which is dependent on your programming language.

For example in C# it would be File.ReadAllLines("myfile.xml").