Your characters
method is setup to only collect on the first call.
@Override
public void characters(char[] ch, int start, int length)
throws SAXException {
if(currTag) {
currTagVal = currTagVal + new String(ch, start, length);
currTag = false;
}
}
The line
currTag = false;
is preventing the characters method from collecting all the data. It is never guaranteed to all show up together, and this code makes later calls to this method do nothing.
In fact I suspect you don't need the currTag
field at all, as it is only used as the if condition in this method, and is set true in startElement
and false in endElement
.
You can likely reduce this method to
@Override
public void characters(char[] ch, int start, int length)
throws SAXException {
currTagVal = currTagVal + new String(ch, start, length);
}