I have an XML file to parse
<?xml version="1.0" encoding="UTF-8"?>
<Response>
<WiFi>
<SSID>testwifi</SSID>
<Key>testkey</Key>
</WiFi>
<Contact>
BEGIN:VCARD
VERSION:2.1
N:;AL entertainment;;;
FN:AL entertainment
TEL;CELL;PREF:543-212
END:VCARD
BEGIN:VCARD
VERSION:2.1
N:Gump;Forrest;;;
FN:Forrest Gump
TEL;CELL;PREF:543-404
EMAIL;PREF:satvinder94@gmail.com
END:VCARD
</Contact>
</Response>
I am parsing it using below code.
public boolean getXmlFromUrl() {
boolean status = false;
StringBuffer output = new StringBuffer("");
try {
InputStream stream = null;
URL url = new URL("uploaded url to test server URL");
URLConnection connection = url.openConnection();
HttpURLConnection httpConnection = (HttpURLConnection)connection;
httpConnection.setRequestMethod("GET");
httpConnection.connect();
if (httpConnection.getResponseCode() == HttpURLConnection.HTTP_OK) {
stream = httpConnection.getInputStream()
BufferedReader buffer = new BufferedReader(new InputStreamReader(stream));
String s = "";
while ((s = buffer.readLine()) != null
output.append(s);
status = true;
}
mScanXMLStr = output.toString();
Log.d(TAG,"string :: "+mScanXMLStr);
} catch (Exception ex) {
ex.printStackTrace();
}
return status;
}
Ho can I preserve new line in contact tag i.e. from BEGIN:VCARD to END:VCARD?