_ignoreSubtreeDepth--;
} else if (_valueReader != null) {
if (_valueReader.hasOpenElements()) {
_valueReader.endElement();
} else if (!_elementStack.isEmpty()) {
DocumentNode currentElement = _elementStack.peek();
if (currentElement.isAttribute()) {
DocumentAttributeNode attribute = (DocumentAttributeNode)currentElement;
if (!attribute.hasValue()) {
attribute.setValue(_valueReader.value());
_valueReader = null;
_elementStack.pop();
} else {
throw new WikiDataException(WikiDataException.InvaldInputData, "Duplicate text value for attribute " + attribute.label());
}
} else {
throw new WikiDataException(WikiDataException.InvaldInputData, "Unexpected text value under element " + currentElement.label());
}
} else {
throw new WikiDataException(WikiDataException.InvaldInputData, "Trying to close non-existing element past end of document");
}
} else if (!_elementStack.isEmpty()) {