In this case you can use StringBuffer.
Initialize the StringBuffer in the startElement.
public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException {
//reset
buffer = new StringBuffer();
....
}
Then in the characters just add the content to the StringBuffer.
public void characters(char[] ch, int start, int length) throws SAXException {
buffer.append(new String(ch,start,length));
}
And then finally use this StringBuffer in the endElement.
public void endElement(String uri, String localName, String qName) throws SAXException {
// use StringBuffer's object buffer here
}
This will surely work.