use of org.apache.axiom.core.stream.CharacterData in project webservices-axiom by apache.
the class ContentHandlerXmlHandler method processCharacterData.
public void processCharacterData(Object data, boolean ignorable) throws StreamException {
try {
switch(characterDataMode) {
case PASS_THROUGH:
if (ignorable) {
writeToBuffer(data.toString());
contentHandler.ignorableWhitespace(buffer, 0, bufferPos);
bufferPos = 0;
} else if (data instanceof CharacterData) {
try {
((CharacterData) data).writeTo(this);
} catch (IOException ex) {
Throwable cause = ex.getCause();
SAXException saxException;
if (cause instanceof SAXException) {
saxException = (SAXException) cause;
} else {
saxException = new SAXException(ex);
}
throw new StreamException(saxException);
}
} else {
writeToBuffer(data.toString());
contentHandler.characters(buffer, 0, bufferPos);
bufferPos = 0;
}
break;
case BUFFER:
writeToBuffer(data.toString());
break;
case ACCUMULATE:
accumulator.append(data);
break;
case SKIP:
}
} catch (SAXException ex) {
throw new StreamException(ex);
}
}
Aggregations