I am parsing an XML file from assets folder to dump my data into the database. Later on i may fetch this and display it in a text view. But while parsing i am losing some data, ie, if i have some 50 words within the XML tags before parsing, in my database i am not able to find all of them after parsing.
For exmple:
I am parsing this line:
<about>Skandagiri also known as kalavara durga, is an ancient mountain fortess located approximately 70km from Banglore city and 3 km from Chikkaballapur in the Indian State of Karnataka.It is off Bellary road(NH 7, Hyderabad to Bangalore Highway) and overlooks Nandi Hills, Mudddenahalli and Kanive narayanapura.The peak is at an altitude of about 1350 meters</about>
after parsing in my database:
at an altitude of about 1350
i am using String to hold my parsed value like this:
if (element.equalsIgnoreCase("about")){
String str=parsedValue;
}
Use a StringBuffer, since text can be read in chunks and you may be reading just the part of code.
use string buffer and append all the chunks, so that finally you will get the complete text without missing out any data.
Like this: