} else {
_root = new DocumentGroupNode((GroupSchemaNode)_rootSchemaNode);
}
_elementStack.push(_root);
} else {
throw new WikiDataException(WikiDataException.InvaldInputData, "Expected root label " + _rootSchemaNode.label() + " instead of " + label);
}
} else if (!_elementStack.isEmpty()) {
DocumentNode element = _elementStack.peek();
if (element.isGroup()) {
DocumentGroupNode group = (DocumentGroupNode)element;
SchemaNode childSchemaNode = ((GroupSchemaNode)group.schema()).children().get(label);
if (childSchemaNode != null && childSchemaNode.getTimestamp().isCurrent()) {
DocumentNode child = null;
if (childSchemaNode.isAttribute()) {
child = new DocumentAttributeNode((AttributeSchemaNode)childSchemaNode);
_valueReader = new NodeValueReader();
} else {
child = new DocumentGroupNode((GroupSchemaNode)childSchemaNode);
}
group.children().add(child);
_elementStack.push(child);
} else {
_ignoreSubtreeDepth = 1;
}
} else {
throw new WikiFatalException("Missing node value reader for attribute node " + element.label());
}
} else {
throw new WikiDataException(WikiDataException.InvaldInputData, "Multiple root nodes detected");
}
}