I am using saxparser in order to get xml tag contents from file. All works properly for a non long data xml. However, when arribed at certain position, characters() event received truncated ch[] and is triggered twice. For example for 1234567890 is received twice and value is truncated like following example. How to clear char array or memory?
id 1234567890
name myName1
id 1234567890
name myName2
...
(error)
id 1234567
id 890
name myName3
Code:
private StringBuffer buf = new StringBuffer(2048);
@Override
public void characters(char ch[], int start, int length) throws SAXException {
if(this.v_Id){
buf.append(ch, start, length);
myParsedXMLDataSet.setId(buf.toString());
Log.d("id", buf.toString());
buf.delete(0, buf.length());
}