<?xml version="1.0" encoding="UTF-8"?>

<!--
	This DTD defines the web flow XML syntax. Web flows capture the page flow
	in (part of) a web application.

	XML documents that conform to this DTD should declare the following doctype:

	<!DOCTYPE web-flow PUBLIC "-//ERVACON//DTD SPRING WEB FLOW//EN"
		"http://www.ervacon.com/dtd/web-flow.dtd">
		
	@root web-flow
-->


<!--
	Defines the root element for a web flow definition. Web flows
	are composed of a number of states.
-->
<!ELEMENT web-flow (
	start-state,
	(action-state | view-state | flow-state | end-state)+
)>

<!--
	Name of the web flow.
-->
<!ATTLIST web-flow name CDATA #REQUIRED>

<!--
	Defines the start state of the flow. This identifies the state
	where flow execution will begin.
-->
<!ELEMENT start-state EMPTY>

<!--
	Name of the first state of the flow.
-->
<!ATTLIST start-state state IDREF #REQUIRED>


<!--
	Defines an action state: a state where an action is executed.
	Transitions triggered by the action(s) lead on to other states.
-->
<!ELEMENT action-state (
	action+, transition+
)>

<!--
	Unique id of an action state.
-->
<!ATTLIST action-state id ID #REQUIRED>


<!--
	Defines a view state: a state where a view will be rendered.
	Transitions triggered by the view lead on to other states.
-->
<!ELEMENT view-state (
	transition*
)>

<!--
	Unique id of a view state.
-->
<!ATTLIST view-state id ID #REQUIRED>

<!--
	Name of the view that will be rendered. This is optional. When
	not present, the response should have been generated elsewhere,
	e.g. in an action of an action state.
-->
<!ATTLIST view-state view CDATA #IMPLIED>


<!--
	Defines a flow state: a state where another flow is executed. When the
	sub flow reaches an end state, the corresponding transition in this state
	is triggered to continue the flow.
-->
<!ELEMENT flow-state (
	transition*
)>

<!--
	Unique id of a flow state.
-->
<!ATTLIST flow-state id ID #REQUIRED>

<!--
	Name of the flow that will be rendered. This is the name of a bean
	in the application context associated with the flow controller.
-->
<!ATTLIST flow-state flow CDATA #REQUIRED>

<!--
	Optional name of a mapper that will map model data to and from the sub flow.
	This is the name of a bean in the application context associated with the
	flow controller.
-->
<!ATTLIST flow-state model-mapper CDATA #IMPLIED>


<!--
	Defines an end state: a state that terminates the flow.
-->
<!ELEMENT end-state EMPTY>

<!--
	Unique id of an end state.
-->
<!ATTLIST end-state id ID #REQUIRED>

<!--
	Name of the view that will be rendered. This is optional.
-->
<!ATTLIST end-state view CDATA #IMPLIED>


<!--
	Defines a transition to another state.
-->
<!ELEMENT transition EMPTY>

<!--
	Name of the transition. This name is of the form "[actionId'.']event". So
	the name of the event that will trigger the transition is prepended with
	the id of the action that signals the event. Both are cancatenated using
	a dot. So when you have an action with id "myAction" that signals an
	event "ok", the name of the corresponding transition should be "myAction.ok".
	
	For the events signaled by a view state or a subflow state, no action is involved so
	the transition name is simply the name of the event that triggers the transition
	("ok" in the previous example).
-->
<!ATTLIST transition name CDATA #REQUIRED>

<!--
	Target state of the transition.
-->
<!ATTLIST transition to IDREF #REQUIRED>


<!--
	Defines an action that is executed by the flow in an action state.
-->
<!ELEMENT action EMPTY>

<!--
	Name of the action.
-->
<!ATTLIST action name CDATA #REQUIRED>

<!--
	Name of the bean definition of the action in the application context
	hierarchy linked with the flow. This is similar to the <ref bean="myBean"/>
	notation of the Spring beans DTD.
-->
<!ATTLIST action bean CDATA #REQUIRED>