<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xml:lang="en">
    <xsd:annotation>
	<xsd:documentation>
	    Redefines the main XML Query Language schema in XpressEngine to
	    validate SQL INSERT.. SELECT.. statements (as opposed to a plain
	    INSERT INTO.. VALUES.. statement).

	    XpressEngine is an open source framework for creating your web sites.
	    http://xpressengine.org/

	    Author: Adrian Constantin, Arnia Software (adrian.constantin@arnia.ro)
	    Date:   09 mar 2012
	</xsd:documentation>
    </xsd:annotation>
 
    <xsd:redefine schemaLocation="xml_insert_generic.xsd">

	<xsd:complexType name="SqlInsertStatementType">
	    <xsd:complexContent>
		<xsd:restriction base="SqlInsertStatementType">
		    <xsd:all>
			<xsd:element name="columns" type="ColumnsAssignamentType">
			    <xsd:key name="distinct_column_names_list">
				<xsd:selector xpath="column" />
				<xsd:field xpath="@name" />
			    </xsd:key>
			</xsd:element>
			<xsd:element name="tables" type="DataChangeStatementTablesType" />
			<xsd:element name="query" type="ExpressionSubqueryContents" />
		    </xsd:all>

		    <xsd:attribute name="action" type="insertSelectAttributeType" use="required" />
		</xsd:restriction>
	    </xsd:complexContent>
	</xsd:complexType>
	
    </xsd:redefine>

    <xsd:simpleType name="insertSelectAttributeType">
	<xsd:restriction base="insertGenericAttributeType">
	    <xsd:pattern value="[Ii][Nn][Ss][Ee][Rr][Tt]-[Ss][Ee][Ll][Ee][Cc][Tt]" />
	</xsd:restriction>
    </xsd:simpleType>
</xsd:schema>
