first i am sorry for my english i am not a native speaker.
I have a android app in which i try to parse an xml file which is anywhere on the phone(is selected via a filechooser). I get from the filechooser a path like this: /storage/emulated/0/file.xml
this is the xml file:
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<kartenset>
<row thema="Test"><id>22</id><id_thema>14</id_thema><frage>Frage 1</frage><frage_bild/><antwort_text>Frage 1 Antowrt</antwort_text><antwort_bild/></row>
<row thema="Testfdd"><id>23</id><id_thema>14</id_thema><frage>Frage 2</frage><frage_bild/><antwort_text>Frage 2 Antwort</antwort_text><antwort_bild/></row>
</kartenset>
i think this part is also interesting
InputSource inputSource = new InputSource();
inputSource.setEncoding("utf-8");
inputSource.setCharacterStream(new StringReader(path));
xr.parse(inputSource);
the xml parser is working when i download the same file from the web(of course with url openstream...)
i tried also:
xr.parse(new InputSource(cont.getResources().getAssets().open(p_uri)));
and different encodings.
i hope anyone can help me. thanks
EDIT:
I get it. now it works. no exception. the solution was this here:
InputSource inputSource = new InputSource();
inputSource.setEncoding("utf-8");
inputSource.setCharacterStream(new StringReader(p_uri));
xr.parse(new InputSource(new FileReader(new File(p_uri))));