public static void parseCorrelations( XMLStreamReader input, Contextual<?> ctx, ExecCompilerContext context) throws XMLStreamException, ParserException { while (input.hasNext()) { int type = input.getEventType(); switch (type) { case XMLStreamConstants.START_ELEMENT: ParserUtils.assertStart(input, CORRELATIONS); Contextual<Correlations> corrs = new Contextual<Correlations>(CORRELATIONS, Correlations.class, ctx); ParserUtils.setLocation(input, context.source().srcRef(), corrs); ctx.children().add(corrs); while (input.nextTag() == XMLStreamConstants.START_ELEMENT) { if (CORRELATION.equals(input.getName())) { Instructional<Correlation> corr = new Instructional<Correlation>(CORRELATION, Correlation.class, corrs); ParserUtils.setLocation(input, context.source().srcRef(), corr); corrs.children().add(corr); while (input.nextTag() == XMLStreamConstants.START_ELEMENT) { context.parseContent(input, corr); } } else { context.parseContent(input, corrs); } } break; case XMLStreamConstants.END_ELEMENT: ParserUtils.assertEnd(input, CORRELATIONS); return; } } }
public void parseFromParts( XMLStreamReader input, Contextual<Receive> receive, ExecCompilerContext context) throws XMLStreamException, ParserException { while (input.hasNext()) { int type = input.getEventType(); switch (type) { case XMLStreamConstants.START_ELEMENT: ParserUtils.assertStart(input, FROMPARTS); Contextual<FromParts> fromParts = new Contextual<FromParts>(FROMPARTS, FromParts.class, receive); ParserUtils.setLocation(input, context.source().srcRef(), fromParts); receive.children().add(fromParts); while (input.nextTag() == XMLStreamConstants.START_ELEMENT) { if (FROMPART.equals(input.getName())) { Instructional<FromPart> fromPart = new Instructional<FromPart>(FROMPART, FromPart.class, fromParts); ParserUtils.setLocation(input, context.source().srcRef(), fromPart); fromParts.children().add(fromPart); while (input.nextTag() == XMLStreamConstants.START_ELEMENT) { context.parseContent(input, fromPart); } } else { context.parseContent(input, fromParts); } } break; case XMLStreamConstants.END_ELEMENT: ParserUtils.assertEnd(input, FROMPARTS); return; } } }
@Override public void parse(XMLStreamReader input, Contextual<Scope> model, ExecCompilerContext context) throws XMLStreamException, ParserException { while (input.hasNext()) { int type = input.getEventType(); switch (type) { case XMLStreamConstants.START_ELEMENT: ParserUtils.assertStart(input, RECEIVE); Receive ins = new Receive(); if (ParserUtils.isContextual(input)) { Contextual<Receive> receive = new Contextual<Receive>(RECEIVE, ins, new Receive(), model); model.children().add(receive); ParserUtils.setLocation(input, context.source().srcRef(), receive); while (input.nextTag() == XMLStreamConstants.START_ELEMENT) { if (CORRELATIONS.equals(input.getName())) { parseCorrelations(input, receive, context); } else if (FROMPARTS.equals(input.getName())) { parseFromParts(input, receive, context); } else { context.parseContent(input, receive); } input.nextTag(); } } else { Instructional<Receive> receive = new Instructional<Receive>(RECEIVE, ins, model); ParserUtils.setLocation(input, context.source().srcRef(), receive); model.children().add(receive); while (input.nextTag() == XMLStreamConstants.START_ELEMENT) { context.parseContent(input, receive); } } break; case XMLStreamConstants.END_ELEMENT: ParserUtils.assertEnd(input, RECEIVE); return; } } }