final ElementImpl last = stack.peek();
if (last.getNodeName().equals(qname)) {
if (charBuf != null && charBuf.length() > 0) {
// remove whitespace if the node has just a single text child,
// keep whitespace for mixed content.
final XMLString normalized;
if ((charBuf.isWhitespaceOnly() && suppressWSmixed) || last.preserveSpace()) {
normalized = charBuf;
} else {
normalized = last.getChildCount() == 0 ?
charBuf.normalize(normalize) :
(charBuf.isWhitespaceOnly() ? null : charBuf);
}
if (normalized != null && normalized.length() > 0) {
text.setData(normalized);
text.setOwnerDocument(document);
last.appendChildInternal(prevNode, text);
if (!validate)
{storeText();}
setPrevious(text);
}
charBuf.reset();
}
stack.pop();
XMLString elemContent = null;
if (!validate && RangeIndexSpec.hasQNameOrValueIndex(last.getIndexType())) {
elemContent = nodeContentStack.pop();
}
if (!validate) {
final String content = elemContent == null ?
null : elemContent.toString();
broker.endElement(last, currentPath, content);
if (indexListener != null)
{indexListener.endElement(transaction, last, currentPath);}
}
currentPath.removeLastComponent();