<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns="http://www.irs.gov/efile" xmlns:xsd="http://www.w3.org/2001/XMLSchema" targetNamespace="http://www.irs.gov/efile" elementFormDefault="qualified" attributeFormDefault="unqualified" version="1.0">

	<xsd:annotation>
		<xsd:documentation>
			<Description>IRS e-file Schema - Form 8838P</Description>
			<TaxYear>2018</TaxYear>
			<MaturityLevel>Final Release</MaturityLevel>
			<ReleaseDate>October 17, 2018</ReleaseDate>
		</xsd:documentation>
	</xsd:annotation>

	<xsd:include schemaLocation="../../../Common/efileTypes.xsd"/>


	<!-- ======================================================================= -->
	<!-- ======================  IRS Form 8838P ================================ -->
	<!-- ======================================================================= -->


	<xsd:element name="IRS8838P">
		<xsd:annotation>
			<xsd:documentation>IRS Form 8838P</xsd:documentation>
		</xsd:annotation>
		<xsd:complexType>
			<xsd:complexContent>
				<xsd:extension base="IRS8838PType">
					<xsd:attributeGroup ref="DocumentAttributes">
						<xsd:annotation>
							<xsd:documentation>Common return document attributes</xsd:documentation>
						</xsd:annotation>
					</xsd:attributeGroup>
					<xsd:attribute name="documentName" type="xsd:string" fixed="IRS8838P">
						<xsd:annotation>
							<xsd:documentation>IRS internal use only. To avoid error in the return, do not include the attribute name or value.</xsd:documentation>
						</xsd:annotation>
					</xsd:attribute>
					<xsd:attribute name="referenceDocumentId" type="IdListType">
						<xsd:annotation>
							<xsd:documentation>List of document ID's of forms, schedules, supporting info. etc. attached to this form</xsd:documentation>
						</xsd:annotation>
					</xsd:attribute>
					<xsd:attribute name="referenceDocumentName" type="StringType" fixed="BinaryAttachment"/>
				</xsd:extension>
			</xsd:complexContent>
		</xsd:complexType>
	</xsd:element>

	<xsd:complexType name="IRS8838PType">
		<xsd:annotation>
			<xsd:documentation>Content model for Form 8838P</xsd:documentation>
		</xsd:annotation>

		<xsd:sequence>
			
			<!-- Business Consent Group -->
			<xsd:element name="BusinessConsentGrp" type="BusinessConsentGrpType" minOccurs="0">
				<xsd:annotation>
					<xsd:documentation>
						<Description>Business consent group</Description>
					</xsd:documentation>
				</xsd:annotation>
			</xsd:element>
			
			<!-- Gain Deferral Contribution Group -->
			<xsd:element name="GainDeferralContributionGrp" type="GainDeferralContributionGrpType" minOccurs="0">
				<xsd:annotation>
					<xsd:documentation>
						<Description>Gain deferral contribution group</Description>
						<LineNumber>1a</LineNumber>
					</xsd:documentation>
				</xsd:annotation>
			</xsd:element>
			
			<!-- Contributions Not Subject Gain Deferral Group -->
			<xsd:element name="ContriNotSubjGainDeferralGrp" type="FederalIncmTxDueType" minOccurs="0">
				<xsd:annotation>
					<xsd:documentation>
						<Description>Contributions not subject gain deferral Group</Description>
						<LineNumber>1b</LineNumber>
					</xsd:documentation>
				</xsd:annotation>
			</xsd:element>

			<!-- Contribution Date -->
			<xsd:element name="ContributionDt" type="DateType">
				<xsd:annotation>
					<xsd:documentation>
						<Description>Contribution Date</Description>
						<LineNumber>5a</LineNumber>
					</xsd:documentation>
				</xsd:annotation>
			</xsd:element>
			
			<!-- Property Description -->
			<xsd:element name="PropertyDesc" type="ShortExplanationType">
				<xsd:annotation>
					<xsd:documentation>
						<Description>Property description</Description>
						<LineNumber>5b</LineNumber>
					</xsd:documentation>
				</xsd:annotation>
			</xsd:element>
			
			<!-- Transferee Name -->
			<xsd:element name="TransfereeName" type="BusinessNameType">
				<xsd:annotation>
					<xsd:documentation>
						<Description>Transferee Name</Description>
						<LineNumber>5c</LineNumber>
					</xsd:documentation>
				</xsd:annotation>
			</xsd:element>
			
			<!-- Transferee EIN or Missing EIN Reason -->
			<xsd:choice>

				<!-- Transferee EIN -->
				<xsd:element name="TransfereeEIN" type="EINType">
					<xsd:annotation>
						<xsd:documentation>
							<Description>Transferee EIN</Description>
							<LineNumber>5c</LineNumber>
						</xsd:documentation>
					</xsd:annotation>
				</xsd:element>

				<!-- Missing EIN Reason Code -->
				<xsd:element name="MissingEINReasonCd">
					<xsd:annotation>
						<xsd:documentation>
							<Description>Missing EIN reason code</Description>
						<LineNumber>5c</LineNumber>
						</xsd:documentation>
					</xsd:annotation>
					<xsd:simpleType>
						<xsd:restriction base="TextType">
							<xsd:enumeration value="APPLD FOR"/>
							<xsd:enumeration value="FOREIGNUS"/>
						</xsd:restriction>
					</xsd:simpleType>
				</xsd:element>

			</xsd:choice>

		</xsd:sequence>
	</xsd:complexType>


	<!-- Business Consent Group Type -->
	<xsd:complexType name="BusinessConsentGrpType">

		<xsd:sequence>

			<!-- Taxpayer Name -->
			<xsd:element name="TaxpayerName" type="BusinessNameType">
				<xsd:annotation>
					<xsd:documentation>
						<Description>Taxpayer name</Description>
					</xsd:documentation>
				</xsd:annotation>
			</xsd:element>

			<!-- EIN or Missing EIN Reason Code -->
			<xsd:choice>

				<!-- EIN -->
				<xsd:element name="EIN" type="EINType">
					<xsd:annotation>
						<xsd:documentation>
							<Description>EIN</Description>
						</xsd:documentation>
					</xsd:annotation>
				</xsd:element>

				<!-- Missing EIN Reason Code -->
				<xsd:element name="MissingEINReasonCd">
					<xsd:annotation>
						<xsd:documentation>
							<Description>Missing EIN reason code</Description>
						</xsd:documentation>
					</xsd:annotation>
					<xsd:simpleType>
						<xsd:restriction base="TextType">
							<xsd:enumeration value="APPLD FOR"/>
						</xsd:restriction>
					</xsd:simpleType>
				</xsd:element>

			</xsd:choice>
			
			<!-- U.S. Address or Foreign Address -->
			<xsd:choice>
				<!-- U.S. Address -->
				<xsd:element name="USAddress" type="USAddressType">
					<xsd:annotation>
						<xsd:documentation>
							<Description>U.S. address</Description>
						</xsd:documentation>
					</xsd:annotation>
				</xsd:element>

				<!-- Foreign Address -->
				<xsd:element name="ForeignAddress" type="ForeignAddressType">
					<xsd:annotation>
						<xsd:documentation>
							<Description>Foreign address </Description>
						</xsd:documentation>
					</xsd:annotation>
				</xsd:element>
			</xsd:choice>
		</xsd:sequence>
		
	</xsd:complexType>
	
	<!-- Gain Deferral Contribution Group Type -->
	<xsd:complexType name="GainDeferralContributionGrpType">

		<xsd:sequence>

			<!-- Federal Income Tax Due Gain Realized Group -->
			<xsd:element name="FederalIncmTxDueGainRlzdGrp" type="FederalIncmTxDueType" minOccurs="0">
				<xsd:annotation>
					<xsd:documentation>
						<Description>Federal income tax due gain realized group</Description>
						<LineNumber>1a</LineNumber>
					</xsd:documentation>
				</xsd:annotation>
			</xsd:element>
			
			<!-- Federal Income Tax Due Allocation Book Group -->
			<xsd:element name="FederalIncmTxDueAllocnBookGrp" type="FederalIncmTxDueType" minOccurs="0">
				<xsd:annotation>
					<xsd:documentation>
						<Description>Federal income tax due allocation book group</Description>
						<LineNumber>1a</LineNumber>
					</xsd:documentation>
				</xsd:annotation>
			</xsd:element>
		</xsd:sequence>
		
	</xsd:complexType>

	<!-- Federal Income Tax Due Type -->
	<xsd:complexType name="FederalIncmTxDueType">

		<xsd:sequence>

			<!-- Tax Year End Date -->
			<xsd:element name="TaxYearEndDt" type="DateType">
				<xsd:annotation>
					<xsd:documentation>
						<Description>Tax year end date</Description>
						<LineNumber>Line 1a, 1b</LineNumber>
					</xsd:documentation>
				</xsd:annotation>
			</xsd:element>

			<!-- Expiration Date -->
			<xsd:element name="ExpirationDt" type="DateType">
				<xsd:annotation>
					<xsd:documentation>
						<Description>Expiration date</Description>
						<LineNumber>Line 1a, 1b</LineNumber>
					</xsd:documentation>
				</xsd:annotation>
			</xsd:element>
		</xsd:sequence>
		
	</xsd:complexType>

</xsd:schema>
