<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:table="http://www.ice.gov/xmlschema/sevisbatch/Table" xmlns:common="http://www.ice.gov/xmlschema/sevisbatch/Common" xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="unqualified" attributeFormDefault="unqualified" version="5.7">
	<xs:import namespace="http://www.ice.gov/xmlschema/sevisbatch/Table" schemaLocation="SEVISTable.xsd"/>
	<xs:import namespace="http://www.ice.gov/xmlschema/sevisbatch/Common" schemaLocation="Common.xsd"/>
	<xs:element name="TransactionLog" type="TransactionLogType"/>
	<xs:complexType name="BatchDetailType">
		<xs:attribute name="resultCode" type="common:ResultCodeType" use="required"/>
		<xs:attribute name="dateTimeStamp" type="table:DateTimeType" use="required"/>
	</xs:complexType>
	<xs:complexType name="ResultType">
		<xs:sequence minOccurs="0">
			<xs:element name="ErrorCode" type="common:ResultCodeType">
				<xs:annotation>
					<xs:documentation>SEVIS defined error code</xs:documentation>
				</xs:annotation>
			</xs:element>
			<xs:element name="ErrorMessage" type="common:RemarksType">
				<xs:annotation>
					<xs:documentation>Error message</xs:documentation>
				</xs:annotation>
			</xs:element>
		</xs:sequence>
		<xs:attribute name="status" type="table:IndicatorYesNoType"/>
	</xs:complexType>
	<xs:complexType name="TransactionLogType">
		<xs:sequence>
			<xs:element name="BatchHeader">
				<xs:annotation>
					<xs:documentation>Standard batch header structure</xs:documentation>
				</xs:annotation>
				<xs:complexType>
					<xs:sequence>
						<xs:element name="BatchID" type="xs:string">
							<xs:annotation>
								<xs:documentation>Unique Batch ID</xs:documentation>
							</xs:annotation>
						</xs:element>
						<xs:element name="OrgID" type="xs:string">
							<xs:annotation>
								<xs:documentation>Unique school or program identifier assigned by SEVIS</xs:documentation>
							</xs:annotation>
						</xs:element>
					</xs:sequence>
				</xs:complexType>
			</xs:element>
			<xs:element name="BatchDetail">
				<xs:annotation>
					<xs:documentation>Detail of batch submittal

The status attribute is set to true if there are no errors associated with this batch submittal.

The system attribute indicates the SEVIS Batch system from which this transaction log was requested by the user and generated by the application.  This is an optional attribute which may contain PROD, ALPHA, BETA, etc.</xs:documentation>
					<xs:documentation>NOTE: status attribute is set to true if there are no errors while processing the entire uploaded XML file.</xs:documentation>
				</xs:annotation>
				<xs:complexType>
					<xs:sequence>
						<xs:element name="Upload" minOccurs="0">
							<xs:annotation>
								<xs:documentation>Details of batch upload

The resultCode attribute is set to success if the upload passes all security requirements and the XML file is accepted and successfully validated against the appropriate SEVIS schema.  Otherwise, resultCode contains the appropriate result / error code.</xs:documentation>
							</xs:annotation>
							<xs:complexType>
								<xs:complexContent>
									<xs:extension base="BatchDetailType">
										<xs:sequence minOccurs="0">
											<xs:element name="FileName">
												<xs:annotation>
													<xs:documentation>Name of uploaded file</xs:documentation>
												</xs:annotation>
												<xs:simpleType>
													<xs:restriction base="xs:string">
														<xs:whiteSpace value="preserve"/>
														<xs:maxLength value="30"/>
													</xs:restriction>
												</xs:simpleType>
											</xs:element>
										</xs:sequence>
									</xs:extension>
								</xs:complexContent>
							</xs:complexType>
						</xs:element>
						<xs:element name="Process" minOccurs="0">
							<xs:annotation>
								<xs:documentation>Detail of batch process

The resultCode attribute is set to success if all submitted records process successfully.  Otherwise, the resultCode indicates either indicates that:

1) file has not yet been processed or 

2) the file has been processed with at least one record failing business rules validation (although all other records are successfully loaded into SEVIS)
</xs:documentation>
							</xs:annotation>
							<xs:complexType>
								<xs:complexContent>
									<xs:extension base="BatchDetailType">
										<xs:sequence minOccurs="0">
											<xs:element name="RecordCount">
												<xs:annotation>
													<xs:documentation>Record process summary</xs:documentation>
												</xs:annotation>
												<xs:complexType>
													<xs:sequence>
														<xs:element name="Success">
															<xs:annotation>
																<xs:documentation>Count of successfully processed records</xs:documentation>
															</xs:annotation>
															<xs:simpleType>
																<xs:restriction base="xs:integer">
																	<xs:totalDigits value="5"/>
																</xs:restriction>
															</xs:simpleType>
														</xs:element>
														<xs:element name="Failure">
															<xs:annotation>
																<xs:documentation>Count of failed records</xs:documentation>
															</xs:annotation>
															<xs:simpleType>
																<xs:restriction base="xs:integer">
																	<xs:totalDigits value="5"/>
																</xs:restriction>
															</xs:simpleType>
														</xs:element>
														<xs:element name="Total">
															<xs:annotation>
																<xs:documentation>Total number of records </xs:documentation>
															</xs:annotation>
															<xs:simpleType>
																<xs:restriction base="xs:integer">
																	<xs:totalDigits value="5"/>
																</xs:restriction>
															</xs:simpleType>
														</xs:element>
													</xs:sequence>
												</xs:complexType>
											</xs:element>
											<xs:element name="Record" maxOccurs="unbounded">
												<xs:annotation>
													<xs:documentation>Princial Record Detail

Each record at this level is directly related to each record at the top level of the submitted XML (e.g. Student or Visitor)</xs:documentation>
													<xs:documentation>NOTE: Each record at this level is directly related to each record at the top level of the submitted XML (e.g. Student or Visitor)</xs:documentation>
												</xs:annotation>
												<xs:complexType>
													<xs:sequence>
														<xs:element name="UserDefinedA" type="common:UserDefinedAType" minOccurs="0">
															<xs:annotation>
																<xs:documentation>User defined field A for principal record</xs:documentation>
															</xs:annotation>
														</xs:element>
														<xs:element name="UserDefinedB" type="common:UserDefinedBType" minOccurs="0">
															<xs:annotation>
																<xs:documentation>User defined field B for principal record</xs:documentation>
															</xs:annotation>
														</xs:element>
														<xs:element name="ProcessDate" type="table:DateTimeType">
															<xs:annotation>
																<xs:documentation>Date and time this record was processed</xs:documentation>
															</xs:annotation>
														</xs:element>
														<xs:element name="Result" type="ResultType">
															<xs:annotation>
																<xs:documentation>Principal Record Result

The status attribute is set to true if this record is successfully loaded into SEVIS.  If the attempt failed, then the list of errors appear below this element.

All validation errors appear at the principal level.</xs:documentation>
																<xs:documentation>NOTE: status attribute is set to true if this record is successfully loaded into SEVIS.  If the attempt failed, then the list of errors appear below this element.</xs:documentation>
															</xs:annotation>
														</xs:element>
														<xs:element name="Dependent" minOccurs="0" maxOccurs="unbounded">
															<xs:annotation>
																<xs:documentation>Dependent Record Detail

Records at this level correspond to the dependent records within the principal record (e.g. Student or Visitor) of the submitted XML.</xs:documentation>
																<xs:documentation>NOTE: Records at this level correspond to the dependent records within the principal record (e.g. Student or Visitor) of the submitted XML.</xs:documentation>
															</xs:annotation>
															<xs:complexType>
																<xs:sequence>
																	<xs:element name="UserDefinedA" type="common:UserDefinedAType" minOccurs="0">
																		<xs:annotation>
																			<xs:documentation>User defined field A for dependent record</xs:documentation>
																		</xs:annotation>
																	</xs:element>
																	<xs:element name="UserDefinedB" type="common:UserDefinedBType" minOccurs="0">
																		<xs:annotation>
																			<xs:documentation>User defined field B for dependent record</xs:documentation>
																		</xs:annotation>
																	</xs:element>
																</xs:sequence>
																<xs:attribute name="dependentSevisID" type="common:SevisIDType" use="optional"/>
															</xs:complexType>
														</xs:element>
													</xs:sequence>
													<xs:attribute name="sevisID" type="common:SevisIDType" use="optional"/>
													<xs:attribute name="userID" type="common:UserIdType" use="optional"/>
													<xs:attribute name="requestID" type="common:RequestID" use="required"/>
												</xs:complexType>
											</xs:element>
										</xs:sequence>
									</xs:extension>
								</xs:complexContent>
							</xs:complexType>
						</xs:element>
						<xs:element name="Download" minOccurs="0">
							<xs:annotation>
								<xs:documentation>Details of batch download

The resultCode attribute is set to success if download passes all security requirements and there was an XML file processed for this OrgID and BatchID (pass or fail).  Otherwise, resultCode contains the appropriate result / error code.</xs:documentation>
							</xs:annotation>
							<xs:complexType>
								<xs:attribute name="resultCode" type="common:ResultCodeType" use="required"/>
							</xs:complexType>
						</xs:element>
					</xs:sequence>
					<xs:attribute name="status" type="table:IndicatorYesNoType" use="required"/>
					<xs:attribute name="system" use="optional">
						<xs:simpleType>
							<xs:restriction base="xs:string">
								<xs:maxLength value="30"/>
							</xs:restriction>
						</xs:simpleType>
					</xs:attribute>
				</xs:complexType>
			</xs:element>
		</xs:sequence>
	</xs:complexType>
</xs:schema>
