* @see
* freeplane.persistence.xml.n3.nanoxml.IXMLBuilder#endElement(java.lang
* .String, java.lang.String, java.lang.String)
*/
public void endElement(final String name, final String nsPrefix, final String nsURI) throws Exception {
final XMLElement lastBuiltElement = xmlBuilder.getParentElement();
xmlBuilder.endElement(name, nsPrefix, nsURI);
if (saveAsXmlUntil == lastBuiltElement) {
saveAsXmlUntil = null;
}
if (saveAsXmlUntil != null) {
return;
}
tag = null;
if (0 == elementStack.size()) {
return;
}
final Object element = currentElement;
currentElement = elementStack.removeLast();
if (nodeCreator instanceof IElementContentHandler) {
((IElementContentHandler) nodeCreator).endElement(currentElement, name, element, lastBuiltElement,
elementContentAsString);
}
else if (nodeCreator instanceof IElementDOMHandler) {
((IElementDOMHandler) nodeCreator).endElement(currentElement, name, element, lastBuiltElement);
}
final XMLElement top = lastBuiltElement.getParent();
if (nodeCreator != null && top != null && top.hasChildren()) {
final int lastChildIndex = top.getChildrenCount() - 1;
top.removeChildAtIndex(lastChildIndex);
}
nodeCreator = (IElementHandler) nodeCreatorStack.removeLast();
elementContentAsString = null;
}