lastElement = sbmlElements.peek();
}
// Characters
else if (event.isCharacters()) {
Characters characters = event.asCharacters();
if (!characters.isWhiteSpace()) {
isText = true; // the characters are not only 'white spaces'
}
if (sbmlElements.peek() instanceof XMLNode || isInsideNotes) {
isText = true; // We want to keep the whitespace/formatting when reading html block
}
// process the text of a XML element.
if ((parser != null) && !sbmlElements.isEmpty() && (isText || isInsideAnnotation)) {
if (isInsideNotes) {
parser = initializedParsers.get(JSBML.URI_XHTML_DEFINITION);
}
// else if (isInsideAnnotation) {
// parser = initializedParsers.get("anyAnnotation");
// }
if (logger.isDebugEnabled()) {
logger.debug(" Parser = " + parser.getClass().getName());
logger.debug(" Characters = @" + characters.getData() + "@");
}
if (currentNode != null) {
// logger.debug("isCharacter: elementName = " + currentNode.getLocalPart());
parser.processCharactersOf(currentNode.getLocalPart(),
characters.getData(), sbmlElements.peek());
} else {
parser.processCharactersOf(null, characters.getData(),
sbmlElements.peek());
}
} else if (isText) {
logger.warn(MessageFormat.format("Some characters cannot be read: {0}", characters.getData()));
if (logger.isDebugEnabled()) {
logger.debug("Parser = " + parser);
if (sbmlElements.isEmpty()) {
logger.debug("The Object Stack is empty!");
} else {