Characters Method not Capturing all Data for Element - SAX Parser - Java

Creenbend

New Member
I am parsing an XML document using the SAX parser. I am using the characters method to capture the data provided between two element tags, accounting for the fact that the data will be provided in chunks :\[code\]StringBuilder currentText = new StringBuilder();...public void characters(char ch[], int start, int length) { if (currentText!=null) { for (int i=start; i<start+length; i++) { currentText.append(ch); }\[/code\]Then in the endElement method I am using :\[code\]public void endElement(String namespaceURI, String localName, String qName) throws SAXException { System.out.println("Current Text is " + currentText.toString()); currentText.setLength(0);\[/code\]}The problem is that when I look in the log, currentText is not capturing the entire contents of some of the larger data fields in the XML.Does anyone know why this could be happening ?Thank you.
 
Back
Top