if (item == null) {
// we've reached the end of the children
if (stripDepth == constructorStack.size()) {
stripDepth = -1;
}
ParentNodeConstructor inst = (ParentNodeConstructor)constructorStack.pop();
if (inst instanceof DocumentInstr) {
iteratorStack.pop();
if (iteratorStack.isEmpty()) {
currentEvent = END_DOCUMENT;
nameCode = -1;
return currentEvent;
}
// skip the END_DOCUMENT event for a nested document node
return next();
} else {
currentEvent = END_ELEMENT;
nameCode = -1;
iteratorStack.pop();
return currentEvent;
}
} else if (item instanceof UnconstructedParent) {
// this represents a nested element or document node constructor
UnconstructedParent parent = (UnconstructedParent)item;
ParentNodeConstructor inst = parent.getInstruction();
constructorStack.push(inst);
if (stripDepth < 0 && inst.getValidationMode() == Validation.STRIP) {
stripDepth = constructorStack.size();
}
SequenceIterator content = inst.getContentExpression().iterate(parent.getXPathContext());
if (inst instanceof DocumentInstr) {
iteratorStack.push(content);
// skip the START_DOCUMENT event
return next();
} else {