in src/main/java/org/apache/commons/scxml2/io/SCXMLReader.java [2383:2485]
private static void readSend(final XMLStreamReader reader, final Configuration configuration,
final Executable executable, final ActionsContainer parent)
throws XMLStreamException, ModelException {
if (executable instanceof Finalize) {
// https://www.w3.org/TR/2015/REC-scxml-20150901/#finalize
// [...] the executable content inside <finalize> MUST NOT raise events or invoke external actions.
// In particular, the <send> and <raise> elements MUST NOT occur.
reportIgnoredElement(reader, configuration, SCXMLConstants.ELEM_FINALIZE, SCXMLConstants.XMLNS_SCXML, SCXMLConstants.ELEM_SEND);
return;
}
final Send send = new Send();
send.setId(readAV(reader, SCXMLConstants.ATTR_ID));
String attrValue = readAV(reader, SCXMLConstants.ATTR_IDLOCATION);
if (attrValue != null) {
if (send.getId() != null) {
reportConflictingAttribute(reader, configuration, SCXMLConstants.ELEM_SEND, SCXMLConstants.ATTR_ID, SCXMLConstants.ATTR_IDLOCATION);
}
else {
send.setIdlocation(attrValue);
}
}
send.setDelay(readAV(reader, SCXMLConstants.ATTR_DELAY));
attrValue = readAV(reader, SCXMLConstants.ATTR_DELAYEXPR);
if (attrValue != null) {
if (send.getDelay() != null) {
reportConflictingAttribute(reader, configuration, SCXMLConstants.ELEM_SEND, SCXMLConstants.ATTR_DELAY, SCXMLConstants.ATTR_DELAYEXPR);
}
else {
send.setDelayexpr(attrValue);
}
}
send.setEvent(readAV(reader, SCXMLConstants.ATTR_EVENT));
attrValue = readAV(reader, SCXMLConstants.ATTR_EVENTEXPR);
if (attrValue != null) {
if (send.getEvent() != null) {
reportConflictingAttribute(reader, configuration, SCXMLConstants.ELEM_SEND, SCXMLConstants.ATTR_EVENT, SCXMLConstants.ATTR_EVENTEXPR);
}
else {
send.setEventexpr(attrValue);
}
}
send.setHints(readAV(reader, SCXMLConstants.ATTR_HINTS));
send.setNamelist(readAV(reader, SCXMLConstants.ATTR_NAMELIST));
send.setTarget(readAV(reader, SCXMLConstants.ATTR_TARGET));
attrValue = readAV(reader, SCXMLConstants.ATTR_TARGETEXPR);
if (attrValue != null) {
if (send.getTarget() != null) {
reportConflictingAttribute(reader, configuration, SCXMLConstants.ELEM_SEND, SCXMLConstants.ATTR_TARGET, SCXMLConstants.ATTR_TARGETEXPR);
}
else {
send.setTargetexpr(attrValue);
}
}
send.setType(readAV(reader, SCXMLConstants.ATTR_TYPE));
attrValue = readAV(reader, SCXMLConstants.ATTR_TYPEEXPR);
if (attrValue != null) {
if (send.getType() != null) {
reportConflictingAttribute(reader, configuration, SCXMLConstants.ELEM_SEND, SCXMLConstants.ATTR_TYPE, SCXMLConstants.ATTR_TYPEEXPR);
}
else {
send.setTypeexpr(attrValue);
}
}
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_PARAM.equals(name)) {
if (send.getContent() == null) {
readParam(reader, configuration, send);
}
else {
reportIgnoredElement(reader, configuration, SCXMLConstants.ELEM_SEND, nsURI, name);
}
} else if (SCXMLConstants.ELEM_CONTENT.equals(name) && send.getNamelist() == null && send.getParams().isEmpty()) {
readContent(reader, configuration, send);
}
else {
reportIgnoredElement(reader, configuration, SCXMLConstants.ELEM_SEND, nsURI, name);
}
} else {
reportIgnoredElement(reader, configuration, SCXMLConstants.ELEM_SEND, nsURI, name);
}
break;
case XMLStreamConstants.END_ELEMENT:
break loop;
default:
}
}
send.setParent(executable);
if (parent != null) {
parent.addAction(send);
} else {
executable.addAction(send);
}
}