<?xml version="1.0" encoding="UTF-8"?>
<!-- edited with XMLSpy v2008 (http://www.altova.com) by sas-softwares@procergs.rs.gov.br (PROCERGS) -->
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="http://www.portalfiscal.inf.br/bpe" xmlns:ds="http://www.w3.org/2000/09/xmldsig#" targetNamespace="http://www.portalfiscal.inf.br/bpe" elementFormDefault="qualified" attributeFormDefault="unqualified">
	<xs:include schemaLocation="tiposGeralBPe_v1.00.xsd"/>
	<xs:simpleType name="TVerDFe">
		<xs:annotation>
			<xs:documentation> Tipo Versão</xs:documentation>
		</xs:annotation>
		<xs:restriction base="xs:string">
			<xs:pattern value="1\.00"/>
		</xs:restriction>
	</xs:simpleType>
	<xs:complexType name="TDistDFe">
		<xs:annotation>
			<xs:documentation>Schema XML de validação da área de dados da mensagem da solicitação de distribuição de DF-e</xs:documentation>
		</xs:annotation>
		<xs:sequence>
			<xs:element name="tpAmb" type="TAmb">
				<xs:annotation>
					<xs:documentation>Identificação do Ambiente:  1 - Produção  2 - Homologação</xs:documentation>
				</xs:annotation>
			</xs:element>
			<xs:element name="verAplic" type="TVerAplic">
				<xs:annotation>
					<xs:documentation>Versão do Aplicativo que solicitou a distribuição de DF-e</xs:documentation>
				</xs:annotation>
			</xs:element>
			<xs:element name="cUF" type="TCodUfIBGE">
				<xs:annotation>
					<xs:documentation>UF solicitada</xs:documentation>
				</xs:annotation>
			</xs:element>
			<xs:element name="indDFe">
				<xs:annotation>
					<xs:documentation>Indicador de DF-e solicitados: 
0 - DF-e autorizados pela UF; </xs:documentation>
				</xs:annotation>
				<xs:simpleType>
					<xs:restriction base="xs:unsignedInt">
						<xs:enumeration value="0"/>
					</xs:restriction>
				</xs:simpleType>
			</xs:element>
			<xs:element name="indCompRet">
				<xs:annotation>
					<xs:documentation>Indicador de Compactação da Mensagem de retorno:  0 - sem compactação;  1 - compactação padrão gZip</xs:documentation>
				</xs:annotation>
				<xs:simpleType>
					<xs:restriction base="xs:unsignedInt">
						<xs:enumeration value="0"/>
						<xs:enumeration value="1"/>
					</xs:restriction>
				</xs:simpleType>
			</xs:element>
			<xs:element name="ultNSU" type="TNSU">
				<xs:annotation>
					<xs:documentation>último NSU recebido, caso seja informado com zero, o Ambiente Autorizador tentará localizar o primeiro DF-e existente.</xs:documentation>
				</xs:annotation>
			</xs:element>
			<xs:element name="NSUFin" type="TNSU" minOccurs="0">
				<xs:annotation>
					<xs:documentation>NSU Final que poderá ser retornado nesta requisição.
Campo opcional, se não for informado o serviço de distribuição irá retornar os próximos 50 NSU de busca disponíveis a partir do ultNSU informado
</xs:documentation>
				</xs:annotation>
			</xs:element>
		</xs:sequence>
		<xs:attribute name="versao" type="TVerDFe" use="required"/>
	</xs:complexType>
	<xs:complexType name="TRetDistDFe">
		<xs:annotation>
			<xs:documentation>Schema XML de validação do lote de retorno de documentos ficais eletronicos</xs:documentation>
		</xs:annotation>
		<xs:sequence>
			<xs:element name="tpAmb" type="TAmb">
				<xs:annotation>
					<xs:documentation>Identificação do Ambiente:  1 - Produção  2 - Homologação</xs:documentation>
				</xs:annotation>
			</xs:element>
			<xs:element name="verAplic" type="TVerAplic">
				<xs:annotation>
					<xs:documentation>Versão do Aplicativo que atendeu a pedido de distribuição de DF-e</xs:documentation>
				</xs:annotation>
			</xs:element>
			<xs:element name="cStat" type="TStat">
				<xs:annotation>
					<xs:documentation>código do status de resultado da pesquisa</xs:documentation>
				</xs:annotation>
			</xs:element>
			<xs:element name="xMotivo" type="TMotivo">
				<xs:annotation>
					<xs:documentation>descrição do resultado do pesquisa </xs:documentation>
				</xs:annotation>
			</xs:element>
			<xs:element name="ultNSU" type="TNSU" minOccurs="0">
				<xs:annotation>
					<xs:documentation>último NSU</xs:documentation>
				</xs:annotation>
			</xs:element>
			<xs:element name="ultNSUSVRS" type="TNSU" minOccurs="0">
				<xs:annotation>
					<xs:documentation>último NSU para a UF na SVRS</xs:documentation>
				</xs:annotation>
			</xs:element>
			<xs:choice minOccurs="0">
				<xs:element name="loteDistComp" type="xs:base64Binary"/>
				<xs:element name="loteDistBPe" type="TLoteDistDFe"/>
			</xs:choice>
		</xs:sequence>
		<xs:attribute name="versao" type="TVerDFe" use="required"/>
	</xs:complexType>
	<xs:complexType name="TLoteDistDFe">
		<xs:annotation>
			<xs:documentation>Schema XML de validação da área de dados descompactada</xs:documentation>
		</xs:annotation>
		<xs:sequence maxOccurs="50">
			<xs:element name="proc">
				<xs:complexType>
					<xs:sequence>
						<xs:any processContents="skip">
							<xs:annotation>
								<xs:documentation>informação do proc</xs:documentation>
							</xs:annotation>
						</xs:any>
					</xs:sequence>
					<xs:attribute name="schema" type="xs:string" use="required">
						<xs:annotation>
							<xs:documentation>Identificação do Schema XML de validação do proc, Ex. procBPe_v1.00.xsd.</xs:documentation>
						</xs:annotation>
					</xs:attribute>
					<xs:attribute name="NSU" type="TNSU" use="required">
						<xs:annotation>
							<xs:documentation>número sequencial único do Ambiente Autorizador</xs:documentation>
						</xs:annotation>
					</xs:attribute>
					<xs:attribute name="ipTransmissor" type="TIPv4" use="optional"/>
				</xs:complexType>
			</xs:element>
		</xs:sequence>
		<xs:attribute name="versao" type="TVerDFe" use="required"/>
	</xs:complexType>
</xs:schema>
