android saxparser truncates xml tag content

loithitham

New Member
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?\[code\]id 1234567890name myName1id 1234567890name myName2...(error)id 1234567id 890name myName3\[/code\]Code: \[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()); }\[/code\]
 
Back
Top