text.setData(normalized); text.setOwnerDocument(document); last.appendChildInternal(prevNode, text); prevNode = text; if (!validate)
text.setData(normalized); text.setOwnerDocument(document); last.appendChildInternal(prevNode, text); if (!validate)
	public void endElement(String namespace, String name, String qname) {		final ElementImpl last = (ElementImpl) 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 (!last.preserveSpace()) {					normalized = last.getChildCount() == 0 ? charBuf.normalize(normalize) : 						(charBuf.isWhitespaceOnly() ? null : charBuf);				} else					normalized = charBuf;				if (normalized != null && normalized.length() > 0) {					text.setData(normalized);					text.setOwnerDocument(document);					last.appendChildInternal(prevNode, text);                  prevNode = text;					if (!validate)						storeText();					text.clear();				}				charBuf.reset();			}			stack.pop();						XMLString elemContent = null;			if (GeneralRangeIndexSpec.hasQNameOrValueIndex(last.getIndexType())) {				elemContent = (XMLString) nodeContentStack.pop();			}						if (!validate)			    broker.endElement(last, currentPath, elemContent == null ? null : elemContent.toString());						currentPath.removeLastComponent();			if (validate) {				if (document.getTreeLevelOrder(level) < last.getChildCount()) {					document.setTreeLevelOrder(level, last.getChildCount());				}                if (childCnt != null)                    setChildCount(last);			} else {				document.setOwnerDocument(document);				if (childCnt == null && last.getChildCount() > 0) {					broker.updateNode(transaction, last);				}			}           prevNode = last;			level--;			if (last != rootNode) {				last.clear();				usedElements.push(last);			}		}	}