<xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" targetNamespace="http://www.w3.org/2005/07/scxml" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:import schemaLocation="lifecycle-local.xsd"/>
<xs:element name="scxml">
    <xs:complexType>
      <xs:sequence>
        <xs:element name="state" maxOccurs="unbounded" minOccurs="0">
          <xs:complexType mixed="true">
            <xs:sequence>
              <xs:element name="datamodel" minOccurs="0">
                <xs:complexType>
                  <xs:sequence>
                    <xs:element name="data" maxOccurs="unbounded" minOccurs="0">
                      <xs:complexType>
                        <xs:sequence>
                          <xs:element name="item" maxOccurs="unbounded" minOccurs="0">
                            <xs:complexType mixed="true">
                              <xs:sequence>
                                <xs:element name="permissions" minOccurs="0" >
                                  <xs:complexType>
                                    <xs:sequence>
                                      <xs:element name="permission" maxOccurs="unbounded" minOccurs="0">
                                        <xs:complexType>
                                          <xs:simpleContent>
                                            <xs:extension base="xs:string">
                                              <xs:attribute type="xs:string" name="roles" use="required"/>
                                            </xs:extension>
                                          </xs:simpleContent>
                                        </xs:complexType>
                                      </xs:element>
                                    </xs:sequence>
                                  </xs:complexType>
                                </xs:element>
                                <xs:element name="validations" minOccurs="0">
                                  <xs:complexType>
                                    <xs:sequence>
                                      <xs:element name="validation" minOccurs="0" maxOccurs="unbounded">
                                        <xs:complexType>
                                          <xs:sequence>
                                            <xs:element name="parameter" maxOccurs="unbounded" minOccurs="0">
                                              <xs:complexType>
                                                <xs:simpleContent>
                                                  <xs:extension base="xs:string">
                                                    <xs:attribute type="xs:string" name="name" use="required" />
                                                    <xs:attribute type="xs:string" name="value" use="required" />
                                                  </xs:extension>
                                                </xs:simpleContent>
                                              </xs:complexType>
                                            </xs:element>
                                          </xs:sequence>
                                          <xs:attribute type="xs:string" name="forEvent" use="required"/>
                                          <xs:attribute type="xs:string" name="class" use="required"/>
                                        </xs:complexType>
                                      </xs:element>
                                    </xs:sequence>
                                  </xs:complexType>
                                </xs:element>
                              </xs:sequence>
                              <xs:attribute type="xs:string" name="name" use="optional"/>
                              <xs:attribute type="xs:string" name="forEvent" use="optional"/>
                            </xs:complexType>
                          </xs:element>
                          <xs:element name="execution" maxOccurs="unbounded" minOccurs="0">
                            <xs:complexType mixed="true">
                              <xs:sequence>
                                <xs:element name="parameter" maxOccurs="unbounded" minOccurs="0">
                                  <xs:complexType>
                                    <xs:simpleContent>
                                      <xs:extension base="xs:string">
                                        <xs:attribute type="xs:string" name="name" use="optional"/>
                                        <xs:attribute type="xs:string" name="value" use="optional"/>
                                      </xs:extension>
                                    </xs:simpleContent>
                                  </xs:complexType>
                                </xs:element>
                              </xs:sequence>
                              <xs:attribute type="xs:string" name="forEvent" use="optional"/>
                              <xs:attribute type="xs:string" name="class" use="optional"/>
                            </xs:complexType>
                          </xs:element>
                          <xs:element name="ui" minOccurs="0" maxOccurs="unbounded">
                            <xs:complexType>
                              <xs:simpleContent>
                                <xs:extension base="xs:string">
                                  <xs:attribute type="xs:string" name="forEvent" use="optional"/>
                                  <xs:attribute type="xs:string" name="href" use="optional"/>
                                </xs:extension>
                              </xs:simpleContent>
                            </xs:complexType>
                          </xs:element>
                          <xs:element name="permission" minOccurs="0" maxOccurs="unbounded">
                            <xs:complexType>
                              <xs:simpleContent>
                                <xs:extension base="xs:string">
                                  <xs:attribute type="xs:string" name="roles" use="required"/>
                                  <xs:attribute type="xs:string" name="forEvent" use="required"/>
                                </xs:extension>
                              </xs:simpleContent>
                            </xs:complexType>
                          </xs:element>
                          <xs:element name="validation" minOccurs="0" maxOccurs="unbounded">
                            <xs:complexType>
                              <xs:sequence>
                                <xs:element name="parameter" maxOccurs="unbounded" minOccurs="0">
                                  <xs:complexType>
                                    <xs:simpleContent>
                                      <xs:extension base="xs:string">
                                        <xs:attribute type="xs:string" name="name" use="required" />
                                        <xs:attribute type="xs:string" name="value" use="required" />
                                      </xs:extension>
                                    </xs:simpleContent>
                                  </xs:complexType>
                                </xs:element>
                              </xs:sequence>
                              <xs:attribute type="xs:string" name="forEvent" use="required"/>
                              <xs:attribute type="xs:string" name="class" use="required"/>
                            </xs:complexType>
                          </xs:element>
                          <xs:element name="js" minOccurs="0" maxOccurs="unbounded">
                            <xs:complexType>
                              <xs:sequence>
                                <xs:element name="console" minOccurs="0">
                                  <xs:complexType>
                                    <xs:sequence>
                                      <xs:element name="script">
                                        <xs:complexType>
                                          <xs:simpleContent>
                                            <xs:extension base="xs:string">
                                              <xs:attribute type="xs:string" name="type" use="required" />
                                            </xs:extension>
                                          </xs:simpleContent>
                                        </xs:complexType>
                                      </xs:element>
                                    </xs:sequence>
                                    <xs:attribute type="xs:string" name="function" use="required"/>
                                  </xs:complexType>
                                </xs:element>
                                <xs:element name="server" minOccurs="0">
                                  <xs:complexType>
                                    <xs:sequence>
                                      <xs:element name="script">
                                        <xs:complexType>
                                          <xs:attribute type="xs:string" name="type"/>
                                        </xs:complexType>
                                      </xs:element>
                                    </xs:sequence>
                                    <xs:attribute type="xs:string" name="function" use="required"/>
                                  </xs:complexType>
                                </xs:element>
                              </xs:sequence>
                              <xs:attribute type="xs:string" name="forEvent" use="required"/>
                            </xs:complexType>
                          </xs:element>
                        </xs:sequence>
                        <xs:attribute type="xs:string" name="name" use="optional"/>
                      </xs:complexType>
                    </xs:element>
                  </xs:sequence>
                </xs:complexType>
              </xs:element>
              <xs:element name="transition" maxOccurs="unbounded" minOccurs="0">
                <xs:complexType>
                  <xs:simpleContent>
                    <xs:extension base="xs:string">
                      <xs:attribute type="xs:string" name="event" use="optional"/>
                      <xs:attribute type="xs:string" name="target" use="optional"/>
                    </xs:extension>
                  </xs:simpleContent>
                </xs:complexType>
              </xs:element>
            </xs:sequence>
            <xs:attribute type="xs:string" name="id" use="optional"/>
          </xs:complexType>
        </xs:element>
      </xs:sequence>
      <xs:attribute type="xs:float" name="version"/>
      <xs:attribute type="xs:string" name="initialstate"/>
    </xs:complexType>
  </xs:element>
</xs:schema>
