JBlock loop = b._while(depthVar.gte(targetDepthVar.minus(JExpr.lit(1)))).body();
b = loop._if(event.eq(JExpr.lit(XMLStreamConstants.START_ELEMENT)))._then();
JConditional ifDepth = b._if(depthVar.eq(targetDepthVar));
Map<QName, ExpectedElement> globalAndLocalEls = new HashMap<QName, ExpectedElement>();
globalAndLocalEls.putAll(elements);
globalAndLocalEls.putAll(buildContext.getGlobalElements());
writeElementReader(globalAndLocalEls, ifDepth._then(), xsrVar, false);
if (allowUnknown) {
writeElementReader(buildContext.getGlobalElements(), ifDepth._else(), xsrVar, true);
}
JConditional ifHasNext = loop._if(xsrVar.invoke("hasNext"));
ifHasNext._then().assign(event, xsrVar.invoke("next"));
ifHasNext._then().assign(depthVar, xsrVar.invoke("getDepth"));
ifHasNext._else()._break();
}
}
removeBraces(preElementBlock);
}