in src/main/java/org/apache/commons/scxml2/io/SCXMLReader.java [1443:1526]
private static void readExecutableContext(final XMLStreamReader reader, final Configuration configuration,
final Executable executable, final ActionsContainer parent)
throws XMLStreamException, ModelException {
String end = "";
if (parent != null) {
end = parent instanceof If ? SCXMLConstants.ELEM_IF : SCXMLConstants.ELEM_FOREACH;
} else if (executable instanceof SimpleTransition) {
end = SCXMLConstants.ELEM_TRANSITION;
} else if (executable instanceof OnEntry) {
end = SCXMLConstants.ELEM_ONENTRY;
} else if (executable instanceof OnExit) {
end = SCXMLConstants.ELEM_ONEXIT;
} else if (executable instanceof Finalize) {
end = SCXMLConstants.ELEM_FINALIZE;
}
loop : while (reader.hasNext()) {
String name, nsURI;
switch (reader.next()) {
case XMLStreamConstants.START_ELEMENT:
nsURI = reader.getNamespaceURI();
name = reader.getLocalName();
if (SCXMLConstants.XMLNS_SCXML.equals(nsURI)) {
if (SCXMLConstants.ELEM_RAISE.equals(name)) {
if (executable instanceof Finalize) {
reportIgnoredElement(reader, configuration, SCXMLConstants.ELEM_FINALIZE, nsURI, name);
} else {
readRaise(reader, configuration, executable, parent);
}
} else if (SCXMLConstants.ELEM_FOREACH.equals(name)) {
readForeach(reader, configuration, executable, parent);
} else if (SCXMLConstants.ELEM_IF.equals(name)) {
readIf(reader, configuration, executable, parent);
} else if (SCXMLConstants.ELEM_LOG.equals(name)) {
readLog(reader, executable, parent);
} else if (SCXMLConstants.ELEM_ASSIGN.equals(name)) {
readAssign(reader, configuration, executable, parent);
} else if (SCXMLConstants.ELEM_SEND.equals(name)) {
if (executable instanceof Finalize) {
reportIgnoredElement(reader, configuration, SCXMLConstants.ELEM_FINALIZE, nsURI, name);
} else {
readSend(reader, configuration, executable, parent);
}
} else if (SCXMLConstants.ELEM_CANCEL.equals(name)) {
readCancel(reader, configuration, executable, parent);
} else if (SCXMLConstants.ELEM_SCRIPT.equals(name)) {
readScript(reader, configuration, executable, parent);
} else if (SCXMLConstants.ELEM_IF.equals(end) && SCXMLConstants.ELEM_ELSEIF.equals(name)) {
readElseIf(reader, executable, (If) parent);
} else if (SCXMLConstants.ELEM_IF.equals(end) && SCXMLConstants.ELEM_ELSE.equals(name)) {
readElse(reader, executable, (If)parent);
} else {
reportIgnoredElement(reader, configuration, end, nsURI, name);
}
} else if (SCXMLConstants.XMLNS_COMMONS_SCXML.equals(nsURI)) {
if (SCXMLConstants.ELEM_VAR.equals(name)) {
readCustomAction(reader, configuration, Var.CUSTOM_ACTION, executable, parent);
} else {
reportIgnoredElement(reader, configuration, end, nsURI, name);
}
} else { // custom action
CustomAction customAction = null;
if (!configuration.customActions.isEmpty()) {
for (final CustomAction ca : configuration.customActions) {
if (ca.getNamespaceURI().equals(nsURI) && ca.getLocalName().equals(name)) {
customAction = ca;
break;
}
}
}
if (customAction != null) {
readCustomAction(reader, configuration, customAction, executable, parent);
} else {
reportIgnoredElement(reader, configuration, end, nsURI, name);
}
}
break;
case XMLStreamConstants.END_ELEMENT:
break loop;
default:
}
}
}