<?xml version="1.0"?>

<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
            targetNamespace="http://www.publica.inf.br"
            xmlns="http://www.publica.inf.br"
            xmlns:dsig="http://www.w3.org/2000/09/xmldsig#"
            elementFormDefault="qualified"
            attributeFormDefault="unqualified" >

    <xsd:import namespace="http://www.w3.org/2000/09/xmldsig#" schemaLocation="xmldsig-core-schema20020212.xsd" />

    <xsd:simpleType name="tsVersao">
        <xsd:restriction base="xsd:token">
            <xsd:pattern value="[1-9]{1}[0-9]{0,1}\.[0-9]{2}"/>
        </xsd:restriction>
    </xsd:simpleType>

    <xsd:simpleType name="tsUf">
        <xsd:restriction base="xsd:string">
            <xsd:length value="2" fixed="true"/>
        </xsd:restriction>
    </xsd:simpleType>

    <xsd:simpleType name="tsCep">
        <xsd:restriction base="xsd:string">
            <xsd:maxLength value="8"/>
            <xsd:pattern value="[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]"/>
        </xsd:restriction>
    </xsd:simpleType>
	
	<xsd:simpleType name="tsCepValido">
        <xsd:restriction base="xsd:string">
            <xsd:maxLength value="8"/>
           <xsd:pattern value="\d{8}"/>
        </xsd:restriction>
    </xsd:simpleType>
    
    <xsd:simpleType name="tsCepString">
        <xsd:restriction base="xsd:string">
            <xsd:maxLength value="20"/>
        </xsd:restriction>
    </xsd:simpleType>
    
    <xsd:simpleType name="tsRazaoSocial">
        <xsd:restriction base="xsd:string">
            <xsd:maxLength value="115"/>
            <xsd:minLength value="1"/>
            <xsd:whiteSpace value="collapse"/>
        </xsd:restriction>
    </xsd:simpleType>

    <xsd:simpleType name="tsAliquota">
        <xsd:restriction base="xsd:decimal">
            <xsd:totalDigits value="8"/>
            <xsd:fractionDigits value="7"/>
            <xsd:minInclusive value="0"/>
        </xsd:restriction>
    </xsd:simpleType>

    <xsd:simpleType name="tsSerieRps">
        <xsd:restriction base="xsd:string">
            <xsd:maxLength value="5"/>
            <xsd:minLength value="1"/>
            <xsd:whiteSpace value="collapse"/>
        </xsd:restriction>
    </xsd:simpleType>

    <xsd:simpleType name="tsTipoRps">
        <xsd:restriction base="xsd:int">
        </xsd:restriction>
    </xsd:simpleType>

    <xsd:simpleType name="tsNumeroRps">
        <xsd:restriction base="xsd:nonNegativeInteger">
            <xsd:totalDigits value="15"/>
        </xsd:restriction>
    </xsd:simpleType>
    
    <xsd:complexType name="tcContato">
        <xsd:sequence>
            <xsd:element name="Telefone" type="tsTelefone" minOccurs="0" maxOccurs="1"/>
            <xsd:element name="Email" type="tsEmail" minOccurs="0" maxOccurs="1"/>
        </xsd:sequence>
    </xsd:complexType>

    <xsd:simpleType name="tsEmail">
        <xsd:restriction base="xsd:string">
            <xsd:maxLength value="100"/>
            <xsd:minLength value="1"/>
            <xsd:whiteSpace value="collapse"/>
        </xsd:restriction>
    </xsd:simpleType>

    <xsd:simpleType name="tsTelefone">
        <xsd:restriction base="xsd:string">
            <xsd:maxLength value="20"/>
            <xsd:minLength value="1"/>
            <xsd:whiteSpace value="collapse"/>
        </xsd:restriction>
    </xsd:simpleType>

    <xsd:simpleType name="tsBairro">
        <xsd:restriction base="xsd:string">
            <xsd:maxLength value="100"/>
            <xsd:minLength value="1"/>
            <xsd:whiteSpace value="collapse"/>
        </xsd:restriction>
    </xsd:simpleType>
	
    <xsd:simpleType name="tsMunicipio">
        <xsd:restriction base="xsd:string">
            <xsd:maxLength value="60"/>
            <xsd:minLength value="1"/>
            <xsd:whiteSpace value="collapse"/>
        </xsd:restriction>
    </xsd:simpleType>	

    <xsd:simpleType name="tsCpf">
        <xsd:restriction base="xsd:string">
            <xsd:length value="11" fixed="true"/>
        </xsd:restriction>
    </xsd:simpleType>

    <xsd:simpleType name="tsCodigoMunicipioIbge">
        <xsd:restriction base="xsd:int">
            <xsd:totalDigits value="7"/>
        </xsd:restriction>
    </xsd:simpleType>

    <xsd:simpleType name="tsCST">
        <xsd:restriction base="xsd:string">
            <xsd:maxLength value="2"/>
            <xsd:minLength value="2"/>
            <xsd:whiteSpace value="collapse"/>
        </xsd:restriction>
    </xsd:simpleType>

    <xsd:simpleType name="tsNumeroEndereco">
        <xsd:restriction base="xsd:string">
            <xsd:maxLength value="2000"/>
            <xsd:minLength value="1"/>
            <xsd:whiteSpace value="collapse"/>
        </xsd:restriction>
    </xsd:simpleType>

    <xsd:simpleType name="tsDiscriminacao">
        <xsd:restriction base="xsd:string">
            <xsd:maxLength value="10000"/>
            <xsd:minLength value="1"/>
            <xsd:whiteSpace value="collapse"/>
        </xsd:restriction>
    </xsd:simpleType>
    
    <xsd:simpleType name="tsObservacao">
    	<xsd:restriction base="xsd:string">
        	<xsd:maxLength value="10000"/>
        	<xsd:minLength value="1"/>
        <xsd:whiteSpace value="collapse"/>
    	</xsd:restriction>
    </xsd:simpleType>
    
    <xsd:simpleType name="tsUnidadeServico">
        <xsd:restriction base="xsd:string">
            <xsd:maxLength value="5"/>
            <xsd:minLength value="1"/>
            <xsd:whiteSpace value="collapse"/>
        </xsd:restriction>
    </xsd:simpleType>

    <xsd:simpleType name="tsInformacoesComplementares">
        <xsd:restriction base="xsd:string">
            <xsd:maxLength value="2000"/>
            <xsd:minLength value="1"/>
            <xsd:whiteSpace value="collapse"/>
        </xsd:restriction>
    </xsd:simpleType>

    <xsd:simpleType name="tsDiscriminacaoServicosCC">
        <xsd:restriction base="xsd:string">
            <xsd:maxLength value="2000"/>
            <xsd:minLength value="1"/>
            <xsd:whiteSpace value="collapse"/>
        </xsd:restriction>
    </xsd:simpleType>

    <xsd:simpleType name="tsValor">
        <xsd:restriction base="xsd:decimal">
            <xsd:totalDigits value="15"/>
            <xsd:fractionDigits value="2" fixed="true"/>
            <xsd:minInclusive value="0"/>
        </xsd:restriction>
    </xsd:simpleType>

    <xsd:simpleType name="tsItemListaServico">
        <xsd:restriction base="xsd:string">
            <xsd:maxLength value="8"/>
            <xsd:minLength value="1"/>
            <xsd:whiteSpace value="collapse"/>
        </xsd:restriction>
    </xsd:simpleType>
	
	<xsd:simpleType name="tsComplementoEndereco">
        <xsd:restriction base="xsd:string">
            <xsd:maxLength value="100"/>
            <xsd:minLength value="1"/>
            <xsd:whiteSpace value="collapse"/>
        </xsd:restriction>
    </xsd:simpleType>
    
    <xsd:simpleType name="tsDescricaoMunicipio">
        <xsd:restriction base="xsd:string">
            <xsd:maxLength value="100"/>
            <xsd:minLength value="1"/>
            <xsd:whiteSpace value="collapse"/>
        </xsd:restriction>
    </xsd:simpleType>

    <xsd:simpleType name="tsSimNao">
        <xsd:restriction base="xsd:byte">
            <xsd:pattern value="1|2"/>
        </xsd:restriction>
    </xsd:simpleType>

    <xsd:simpleType name="tsCnpj">
        <xsd:restriction base="xsd:string">
            <xsd:length value="14" fixed="true"/>
            <xsd:whiteSpace value="collapse"/>
        </xsd:restriction>
    </xsd:simpleType>

    <xsd:simpleType name="tsNif">
        <xsd:restriction base="xsd:string">
            <xsd:length value="40" fixed="true"/>
            <xsd:whiteSpace value="collapse"/>
        </xsd:restriction>
    </xsd:simpleType>
    
     <xsd:simpleType name="tsCnpjPrestador">
        <xsd:restriction base="xsd:string">
            <xsd:length value="14" fixed="true"/>
            <xsd:whiteSpace value="collapse"/>
        </xsd:restriction>
    </xsd:simpleType>

    <xsd:simpleType name="tsNumeroLote">
        <xsd:restriction base="xsd:nonNegativeInteger">
            <xsd:totalDigits value="10"/>
        </xsd:restriction>
    </xsd:simpleType>
    
    <xsd:simpleType name="tsNumeroNfe">
        <xsd:restriction base="xsd:string">
            <xsd:maxLength value="15"/>
			<xsd:minLength value="1"/>
            <xsd:whiteSpace value="collapse"/>
        </xsd:restriction>
    </xsd:simpleType>

    <xsd:simpleType name="tsInscricaoMunicipal">
        <xsd:restriction base="xsd:string">
            <xsd:maxLength value="15"/>
            <xsd:minLength value="1"/>
            <xsd:whiteSpace value="collapse"/>
        </xsd:restriction>
    </xsd:simpleType>
    
    <xsd:simpleType name="tsTipoIntermediario">
        <xsd:restriction base="xsd:int">
        </xsd:restriction>
    </xsd:simpleType>
    
    <xsd:simpleType name="tsTipoEvento">
        <xsd:restriction base="xsd:int">
        </xsd:restriction>
    </xsd:simpleType>

    <xsd:simpleType name="tsConstrucaoCivilArtigo">
        <xsd:restriction base="xsd:string">
            <xsd:maxLength value="15"/>
            <xsd:minLength value="1"/>
            <xsd:whiteSpace value="collapse"/>
        </xsd:restriction>
    </xsd:simpleType>

    <xsd:simpleType name="tsConstrucaoCivilObra">
        <xsd:restriction base="xsd:string">
            <xsd:maxLength value="15"/>
            <xsd:minLength value="1"/>
            <xsd:whiteSpace value="collapse"/>
        </xsd:restriction>
    </xsd:simpleType>
    
    <xsd:simpleType name="tsConstrucaoCivilNrObra">
        <xsd:restriction base="xsd:string">
            <xsd:maxLength value="15"/>
            <xsd:minLength value="1"/>
            <xsd:whiteSpace value="collapse"/>
        </xsd:restriction>
    </xsd:simpleType>
    
    <xsd:simpleType name="tsConstrucaoCivilTipoAlvara">
        <xsd:restriction base="xsd:string">
            <xsd:maxLength value="4"/>
            <xsd:minLength value="1"/>
            <xsd:whiteSpace value="collapse"/>
        </xsd:restriction>
    </xsd:simpleType>
    
    <xsd:simpleType name="tsConstrucaoCivilEndereco">
        <xsd:restriction base="xsd:string">
            <xsd:maxLength value="100"/>
            <xsd:minLength value="1"/>
            <xsd:whiteSpace value="collapse"/>
        </xsd:restriction>
    </xsd:simpleType>
    
   <xsd:complexType name="tcConstrucaoCivilEndereco">
	    <xsd:sequence>
		    <xsd:element name="Cep" type="tsCepValido" minOccurs="0" maxOccurs="1"/>
			<xsd:element name="Logradouro" type="tsEndereco" minOccurs="0" maxOccurs="1"/>
			<xsd:element name="Numero" type="tsNumeroEndereco" minOccurs="0" maxOccurs="1"/>
	        <xsd:element name="Bairro" type="tsBairro" minOccurs="0" maxOccurs="1"/>
			<xsd:element name="CodigoMunicipio" type="tsCodigoMunicipioIbge" minOccurs="0" maxOccurs="1"/>
			<xsd:element name="Complemento" type="tsComplementoEndereco" minOccurs="0" maxOccurs="1"/>
	        <xsd:element name="Uf" type="tsUf" minOccurs="0" maxOccurs="1"/>
	        <xsd:element name="CodigoPais" type="tsCodigoPaisBacen" minOccurs="0" maxOccurs="1"/>
	    </xsd:sequence>
	</xsd:complexType>

    <xsd:simpleType name="tsQuantidadeRps">
        <xsd:restriction base="xsd:int">
        </xsd:restriction>
    </xsd:simpleType>
    
    <xsd:simpleType name="tsIdentificacao">
	    <xsd:restriction base="xsd:string">
	        <!-- CPF (11 dígitos), CNPJ (14 dígitos) ou NIF (até 20 chars) -->
	        <xsd:pattern value="\d{11}|\d{14}|[A-Za-z0-9]{1,40}"/>
	    </xsd:restriction>
	</xsd:simpleType>
	
	<xsd:simpleType name="tsTipoDestinatarioServico">
	    <xsd:restriction base="xsd:integer">
	        <xsd:enumeration value="0">
	            <xsd:annotation>
	                <xsd:documentation>Em branco / Não informado</xsd:documentation>
	            </xsd:annotation>
	        </xsd:enumeration>
	        <xsd:enumeration value="1">
	            <xsd:annotation>
	                <xsd:documentation>Próprio adquirente do serviço</xsd:documentation>
	            </xsd:annotation>
	        </xsd:enumeration>
	        <xsd:enumeration value="2">
	            <xsd:annotation>
	                <xsd:documentation>Outro adquirente (intermediário ou terceiro)</xsd:documentation>
	            </xsd:annotation>
	        </xsd:enumeration>
	    </xsd:restriction>
	</xsd:simpleType>
	
	<xsd:simpleType name="tsTipoContribuinte">
	    <xsd:restriction base="xsd:integer">
	        <xsd:enumeration value="0">
	            <xsd:annotation>
	                <xsd:documentation>Em branco / Não informado</xsd:documentation>
	            </xsd:annotation>
	        </xsd:enumeration>
	        <xsd:enumeration value="1">
	            <xsd:annotation>
	                <xsd:documentation>CPF</xsd:documentation>
	            </xsd:annotation>
	        </xsd:enumeration>
	        <xsd:enumeration value="2">
	            <xsd:annotation>
	                <xsd:documentation>CNPJ</xsd:documentation>
	            </xsd:annotation>
	        </xsd:enumeration>
	        <xsd:enumeration value="3">
	            <xsd:annotation>
	                <xsd:documentation>NIF (Número de Identificação Fiscal – estrangeiro)</xsd:documentation>
	            </xsd:annotation>
	        </xsd:enumeration>
	        <xsd:enumeration value="4">
	            <xsd:annotation>
	                <xsd:documentation>NNIF - Não informado</xsd:documentation>
	            </xsd:annotation>
	        </xsd:enumeration>
	        <xsd:enumeration value="5">
	            <xsd:annotation>
	                <xsd:documentation>NNIF - Dispensado</xsd:documentation>
	            </xsd:annotation>
	        </xsd:enumeration>
	        <xsd:enumeration value="6">
	            <xsd:annotation>
	                <xsd:documentation>NNIF - Não exigência legal</xsd:documentation>
	            </xsd:annotation>
	        </xsd:enumeration>
	    </xsd:restriction>
	</xsd:simpleType>
	
    <xsd:simpleType name="tsEndereco">
        <xsd:restriction base="xsd:string">
            <xsd:maxLength value="125"/>
            <xsd:minLength value="1"/>
            <xsd:whiteSpace value="collapse"/>
        </xsd:restriction>
    </xsd:simpleType>
    
    <xsd:simpleType name="tsChave">
        <xsd:restriction base="xsd:string">
            <xsd:maxLength value="255"/>
            <xsd:minLength value="1"/>
            <xsd:whiteSpace value="collapse"/>
        </xsd:restriction>
    </xsd:simpleType>

    <xsd:complexType name="tcIdentificacaoTomador">
        <xsd:sequence>
            <xsd:element name="CpfCnpj" type="tcCpfCnpj" minOccurs="0" maxOccurs="1"/>
            <xsd:element name="InscricaoMunicipal" type="tsInscricaoMunicipal" minOccurs="0" maxOccurs="1"/>
            <xsd:element name="Nif" type="tsNif" minOccurs="0" maxOccurs="1"/>
        </xsd:sequence>
    </xsd:complexType>

    <xsd:simpleType name="tsIdTag">
        <xsd:restriction base="xsd:string">
            <xsd:maxLength value="255"/>
        </xsd:restriction>
    </xsd:simpleType>
    
	<xsd:simpleType name="tsTipoImovel">
	    <xsd:restriction base="xsd:integer">
	        <xsd:enumeration value="1"/> <!-- Nacional -->
	        <xsd:enumeration value="2"/> <!-- Internacional -->
	    </xsd:restriction>
	</xsd:simpleType>
	
	<xsd:simpleType name="tsInscricaoImobiliaria">
	    <xsd:restriction base="xsd:string">
	        <xsd:maxLength value="60"/>
	    </xsd:restriction>
	</xsd:simpleType>
	
	<xsd:simpleType name="tsCib">
	    <xsd:restriction base="xsd:string">
	        <xsd:maxLength value="60"/>
	    </xsd:restriction>
	</xsd:simpleType>
	    

    <xsd:simpleType name="tsMotivoCancelamentoNfse">
        <xsd:restriction base="xsd:string">
            <xsd:maxLength value="255"/>
        </xsd:restriction>
    </xsd:simpleType>
    
    <xsd:complexType name="tcRetificacaoRps">
        <xsd:sequence>
            <xsd:element name="NumeroRetificado" type="tsNumeroRps" minOccurs="1" maxOccurs="1"/>
            <xsd:element name="SerieRetificado" type="tsSerieRps" minOccurs="1" maxOccurs="1"/>
            <xsd:element name="TipoRpsRetificado" type="tsTipoRps" minOccurs="1" maxOccurs="1"/>
            <xsd:element name="MotivoRetificacao" type="tsMotivoCancelamentoNfse" minOccurs="1" maxOccurs="1"/>
        </xsd:sequence>
        <xsd:attribute name="nfpIdRetificar" type="tsIdTag"/>
    </xsd:complexType>

    <xsd:complexType name="tcInfRps">
        <xsd:sequence>
            <xsd:element name="IdentificacaoRps" type="tcIdentificacaoRps" minOccurs="1" maxOccurs="1"/>
            <xsd:element name="DataEmissao" type="xsd:dateTime" minOccurs="1" maxOccurs="1"/>
            <xsd:element name="NaturezaOperacao" type="tsNaturezaOperacao" minOccurs="1" maxOccurs="1"/>
            <xsd:element name="OptanteSimplesNacional" type="tsSimNao" minOccurs="1" maxOccurs="1"/>
            <xsd:element name="IncentivadorCultural" type="tsSimNao" minOccurs="1" maxOccurs="1"/>
            <xsd:element name="Competencia" type="xsd:gYearMonth" minOccurs="0" maxOccurs="1"/>
            <xsd:element name="Status" type="tsStatusRps" minOccurs="1" maxOccurs="1"/>
            <xsd:element name="RpsSubstituido" type="tcIdentificacaoRps" minOccurs="0" maxOccurs="1"/>
            <xsd:element name="Servico" type="tcDadosServico" minOccurs="1" maxOccurs="1"/>
            <xsd:element name="Prestador" type="tcIdentificacaoPrestador" minOccurs="1" maxOccurs="1"/>
            <xsd:element name="Tomador" type="tcDadosTomador" minOccurs="0" maxOccurs="1"/>
            <xsd:element name="IntermediarioServico" type="tcIdentificacaoIntermediarioServico" minOccurs="0" maxOccurs="1"/>
            <xsd:element name="AtividadeEvento" type="tcIdentificacaoAtividadeEventos" minOccurs="0" maxOccurs="1"/>
            <xsd:element name="Destinatario" type="tcDestinatario" minOccurs="0" maxOccurs="1"/>
            <xsd:element name="Imovel" type="tcImovel" minOccurs="0" maxOccurs="1"/>
            <xsd:element name="CondicaoPagamento" type="tcCondicoesPagamentos" minOccurs="0" maxOccurs="1"/>
            <xsd:element name="ConstrucaoCivil" type="tcConstrucaoCivil" minOccurs="0" maxOccurs="1"/>
            <xsd:element name="Retificacao" type="tcRetificacaoRps" minOccurs="0" maxOccurs="1"/>
        </xsd:sequence>
        <xsd:attribute name="id" type="tsIdTag"/>
    </xsd:complexType>
    
    <xsd:complexType name="tcCondicoesPagamentos">
        <xsd:sequence>
            <xsd:element name="Parcelas" type="tcParcelas" minOccurs="0" maxOccurs="unbounded"/>
        </xsd:sequence>
    </xsd:complexType>
    
    <xsd:complexType name="tcConstrucaoCivil">
        <xsd:sequence>
     	    <xsd:element name="TipoIdentificacaoObra" type="xsd:int" minOccurs="0" maxOccurs="1"/>
            <xsd:element name="CodigoObra" type="tsConstrucaoCivilObra" minOccurs="0" maxOccurs="1"/>
            <xsd:element name="Art" type="tsConstrucaoCivilArtigo" minOccurs="0" maxOccurs="1"/>
            <xsd:element name="EnderecoCompleto" type="tcConstrucaoCivilEndereco" minOccurs="0" maxOccurs="1"/>
            <xsd:element name="Endereco" type="tsConstrucaoCivilEndereco" minOccurs="0" maxOccurs="1"/>
            <xsd:element name="NrObraAno" type="tsConstrucaoCivilNrObra" minOccurs="0" maxOccurs="1"/>
            <xsd:element name="TipoAlvara" type="tsConstrucaoCivilTipoAlvara" minOccurs="0" maxOccurs="1"/>
            <xsd:element name="InscricaoMunicipal" type="tsInscricaoMunicipal" minOccurs="0" maxOccurs="1"/>
            <xsd:element name="Cib" type="tsCIB" minOccurs="0" maxOccurs="1"/>
        </xsd:sequence>
    </xsd:complexType>
    
    <xsd:simpleType name="tsLinkVisualizacaoNfse"> 
        <xsd:restriction base="xsd:string"> 
            <xsd:maxLength value="2000"/> 
            <xsd:minLength value="1"/> 
            <xsd:whiteSpace value="collapse"/> 
        </xsd:restriction> 
    </xsd:simpleType>
    
    <xsd:simpleType name="tsCIB">
	    <xsd:restriction base="xsd:string">
	        <xsd:length value="8"/>
	        <xsd:whiteSpace value="collapse"/>
	    </xsd:restriction>
	</xsd:simpleType>

    <xsd:complexType name="tcParcelas">
        <xsd:sequence>
            <xsd:element name="Condicao" type="xsd:int" minOccurs="1" maxOccurs="1"/>
            <xsd:element name="Parcela" type="xsd:int" minOccurs="1" maxOccurs="1"/>
            <xsd:element name="Valor" type="tsValor" minOccurs="0" maxOccurs="1"/>
            <xsd:element name="DataVencimento" type="xsd:date" minOccurs="0" maxOccurs="1"/>
        </xsd:sequence>
    </xsd:complexType>
    
    <xsd:element name="EnviarLoteRpsEnvio">
        <xsd:complexType>
            <xsd:sequence>
                <xsd:element name="LoteRps" type="tcLoteRps"/>
                <xsd:element ref="dsig:Signature" minOccurs="0" maxOccurs="1"/>
            </xsd:sequence>
        </xsd:complexType>
    </xsd:element>

    <xsd:complexType name="tcCpfCnpj">
        <xsd:choice>
            <xsd:element name="Cpf" type="tsCpf" minOccurs="1" maxOccurs="1"/>
            <xsd:element name="Cnpj" type="tsCnpj" minOccurs="1" maxOccurs="1"/>
        </xsd:choice>
    </xsd:complexType>
    
    <xsd:complexType name="tcDeducoes">
        <xsd:sequence>
            <xsd:element name="Numero" type="tsNumeroNfe" minOccurs="1" maxOccurs="1"/>
            <xsd:element name="CnpjPrestador" type="tsCnpj" minOccurs="1" maxOccurs="1"/>
            <xsd:element name="Valor" type="tsValor" minOccurs="1" maxOccurs="1"/>
            <xsd:element name="ChaveValidacao" type="tsChave" minOccurs="1" maxOccurs="1"/>
        </xsd:sequence>
    </xsd:complexType>

    <xsd:complexType name="tcLoteRps">
        <xsd:sequence>
            <xsd:element name="NumeroLote" type="tsNumeroLote" minOccurs="1" maxOccurs="1"/>
            <xsd:element name="Cnpj" type="tsCnpj" minOccurs="1" maxOccurs="1"/>
            <xsd:element name="InscricaoMunicipal" type="tsInscricaoMunicipal" minOccurs="1" maxOccurs="1"/>
            <xsd:element name="QuantidadeRps" type="tsQuantidadeRps" minOccurs="1" maxOccurs="1"/>
            <xsd:element name="ListaRps" minOccurs="1" maxOccurs="1">
                <xsd:complexType>
                    <xsd:sequence>
                        <xsd:element name="Rps" maxOccurs="unbounded" type="tcRps" minOccurs="1"/>
                    </xsd:sequence>
                </xsd:complexType>
            </xsd:element>
        </xsd:sequence>
        <xsd:attribute name="id" type="tsIdTag"/>
        <xsd:attribute name="versao" type="tsVersao" use="required" />
    </xsd:complexType>

    <xsd:complexType name="tcIdentificacaoRps">
        <xsd:sequence>
            <xsd:element name="Numero" type="tsNumeroRps" minOccurs="1" maxOccurs="1"/>
            <xsd:element name="Serie" type="tsSerieRps" minOccurs="1" maxOccurs="1"/>
            <xsd:element name="Tipo" type="tsTipoRps" minOccurs="1" maxOccurs="1"/>
            <xsd:element name="cStat" type="TStat" minOccurs="0" maxOccurs="1"/>
        </xsd:sequence>
    </xsd:complexType>
    
    <xsd:simpleType name="TStat">
    	<xsd:annotation>
      		<xsd:documentation>
		        100 - NFS-e Gerada;
		        101 - NFS-e de Substituição Gerada;
		        102 - NFS-e de Decisão Judicial;
		        103 - NFS-e Avulsa;
     		</xsd:documentation>
    	</xsd:annotation>
    <xsd:restriction base="xsd:string">
      	<xsd:whiteSpace value="preserve"/>
	    <xsd:enumeration value="100"/>
	    <xsd:enumeration value="101"/>
	    <xsd:enumeration value="102"/>
	    <xsd:enumeration value="103"/>
    </xsd:restriction>
  </xsd:simpleType>

    <xsd:complexType name="tcRps">
        <xsd:sequence>
            <xsd:element name="InfRps" type="tcInfRps" minOccurs="1" maxOccurs="1"/>
            <xsd:element ref="dsig:Signature" minOccurs="0" maxOccurs="1"/>
        </xsd:sequence>
    </xsd:complexType>

    <xsd:complexType name="tcIdentificacaoPrestador">
        <xsd:sequence>
            <xsd:choice>
                <xsd:element name="CpfCnpj" type="tcCpfCnpj" minOccurs="1" maxOccurs="1" />			
                <xsd:element name="Cnpj" type="tsCnpj" minOccurs="1" maxOccurs="1"/>
            </xsd:choice>
            <xsd:element name="InscricaoMunicipal" type="tsInscricaoMunicipal" minOccurs="1" maxOccurs="1"/>
        </xsd:sequence>
        <xsd:attribute name="id" type="tsIdTag"/>
    </xsd:complexType>

    <xsd:complexType name="tcValores">
        <xsd:sequence>
            <xsd:element name="ValorServicos" type="tsValor" minOccurs="1" maxOccurs="1"/>
            <xsd:element name="ValorDeducoes" type="tsValor" minOccurs="0" maxOccurs="1"/>
            <xsd:element name="ValorPis" type="tsValor" minOccurs="0" maxOccurs="1"/>
            <xsd:element name="ValorCofins" type="tsValor" minOccurs="0" maxOccurs="1"/>
            <xsd:element name="ValorInss" type="tsValor" minOccurs="0" maxOccurs="1"/>
            <xsd:element name="ValorIr" type="tsValor" minOccurs="0" maxOccurs="1"/>
            <xsd:element name="ValorCsll" type="tsValor" minOccurs="0" maxOccurs="1"/>
            <xsd:element name="IssRetido" type="tsSimNao" minOccurs="1" maxOccurs="1"/>
            <xsd:element name="ValorIss" type="tsValor" minOccurs="0" maxOccurs="1"/>
            <xsd:element name="ValorIssRetido" type="tsValor" minOccurs="0" maxOccurs="1"/>
            <xsd:element name="OutrasRetencoes" type="tsValor" minOccurs="0" maxOccurs="1"/>
            <xsd:element name="BaseCalculo" type="tsValor" minOccurs="0" maxOccurs="1"/>
            <xsd:element name="Aliquota" type="tsAliquota" minOccurs="0" maxOccurs="1"/>
            <xsd:element name="ValorLiquidoNfse" type="tsValor" minOccurs="0" maxOccurs="1"/>
            <xsd:element name="DescontoIncondicionado" type="tsValor" minOccurs="0" maxOccurs="1"/>
            <xsd:element name="DescontoCondicionado" type="tsValor" minOccurs="0" maxOccurs="1"/>
            <xsd:element name="UnidadeServico" type="tsUnidadeServico" minOccurs="0" maxOccurs="1"/>
            <xsd:element name="TributosFederais" type="tcTribFed" minOccurs="0" maxOccurs="1"/>
            <xsd:element name="tribMun" type="TCTribMunicipal" minOccurs="0" maxOccurs="1"/>
        </xsd:sequence>
    </xsd:complexType>
    
     <xsd:complexType name="TCTribMunicipal">
	    <xsd:sequence>
	      <xsd:element name="tpImunidade" type="TSTipoImunidadeISSQN" minOccurs="0">
	        <xsd:annotation>
	          <xsd:documentation>
	            Identificação da Imunidade do ISSQN – somente para o caso de Imunidade.
	            Tipos de Imunidades:            
	            0 - Imunidade (tipo não informado na nota de origem);
	            1 - Patrimônio, renda ou serviços, uns dos outros (CF88, Art 150, VI, a);
	            2 - Templos de qualquer culto (CF88, Art 150, VI, b);
	            3 - Patrimônio, renda ou serviços dos partidos políticos, inclusive suas fundações, das entidades sindicais dos trabalhadores, das instituições de educação e de assistência social, sem fins lucrativos, atendidos os requisitos da lei (CF88, Art 150, VI, c);
	            4 - Livros, jornais, periódicos e o papel destinado a sua impressão (CF88, Art 150, VI, d);
	            5 - Fonogramas e videofonogramas musicais produzidos no Brasil contendo obras musicais ou literomusicais de autores brasileiros e/ou obras em geral interpretadas por artistas brasileiros bem como os suportes materiais ou arquivos digitais que os contenham, salvo na etapa de replicação industrial de mídias ópticas de leitura a laser.   (CF88, Art 150, VI, e);
	          </xsd:documentation>
	        </xsd:annotation>
	      </xsd:element>
	    </xsd:sequence>
    </xsd:complexType>
  
    <xsd:simpleType name="TSTipoImunidadeISSQN">
	   <xsd:annotation>
	     <xsd:documentation>
	            Identificação da Imunidade do ISSQN – somente para o caso de Imunidade.
	
	            Tipos de Imunidades:
	            
	            0 - Imunidade (tipo não informado na nota de origem);
	            1 - Patrimônio, renda ou serviços, uns dos outros (CF88, Art 150, VI, a);
	            2 - Templos de qualquer culto (CF88, Art 150, VI, b);
	            3 - Patrimônio, renda ou serviços dos partidos políticos, inclusive suas fundações, das entidades sindicais dos trabalhadores, das instituições de educação e de assistência social, sem fins lucrativos, atendidos os requisitos da lei (CF88, Art 150, VI, c);
	            4 - Livros, jornais, periódicos e o papel destinado a sua impressão (CF88, Art 150, VI, d);
	            5 - Fonogramas e videofonogramas musicais produzidos no Brasil contendo obras musicais ou literomusicais de autores brasileiros e/ou obras em geral interpretadas por artistas brasileiros bem como os suportes materiais ou arquivos digitais que os contenham, salvo na etapa de replicação industrial de mídias ópticas de leitura a laser.   (CF88, Art 150, VI, e);
	     </xsd:documentation>
	   </xsd:annotation>
	   <xsd:restriction base="xsd:string">
	     <xsd:whiteSpace value="preserve"/>
	     <xsd:enumeration value="0"/>
	     <xsd:enumeration value="1"/>
	     <xsd:enumeration value="2"/>
	     <xsd:enumeration value="3"/>
	     <xsd:enumeration value="4"/>
	     <xsd:enumeration value="5"/>
	   </xsd:restriction>
	</xsd:simpleType>

    <xsd:complexType name="tcTribFed">
        <xsd:sequence>
            <xsd:element name="PisCofins" type="tcPiscofins" minOccurs="1" maxOccurs="1"/>
        </xsd:sequence>
    </xsd:complexType>

    <xsd:complexType name="tcPiscofins">
        <xsd:sequence>
            <xsd:element name="CST" type="tsCST" minOccurs="1" maxOccurs="1"/>
            <xsd:element name="ValorBaseCalculoPisCofins" type="tsValor" minOccurs="1" maxOccurs="1"/>
            <xsd:element name="PercentualAliquotaPis" type="tsValor" minOccurs="1" maxOccurs="1"/>
            <xsd:element name="PercentualAliquotaCofins" type="tsValor" minOccurs="1" maxOccurs="1"/>
            <xsd:element name="TipoRetencaoPisCofins" type="xsd:int" minOccurs="1" maxOccurs="1"/>
        </xsd:sequence>
    </xsd:complexType>
    
    <xsd:complexType name="tcValoresCartaCorrecao">
        <xsd:sequence>
            <xsd:element name="ValorCofins" type="tsValor" minOccurs="0" maxOccurs="1"/>
            <xsd:element name="ValorInss" type="tsValor" minOccurs="0" maxOccurs="1"/>
            <xsd:element name="ValorIr" type="tsValor" minOccurs="0" maxOccurs="1"/>
            <xsd:element name="ValorCsll" type="tsValor" minOccurs="0" maxOccurs="1"/>
            <xsd:element name="OutrasRetencoes" type="tsValor" minOccurs="0" maxOccurs="1"/>
            <xsd:element name="ValorPis" type="tsValor" minOccurs="0" maxOccurs="1"/>
            <xsd:element name="DescontoCondicionado" type="tsValor" minOccurs="0" maxOccurs="1"/>
            <xsd:element name="ValorLiquidoNfse" type="tsValor" minOccurs="0" maxOccurs="1"/>
        </xsd:sequence>
    </xsd:complexType>

    <xsd:complexType name="tcEndereco">
        <xsd:sequence>
            <xsd:element name="Endereco" type="tsEndereco" minOccurs="0" maxOccurs="1"/>
            <xsd:element name="Numero" type="tsNumeroEndereco" minOccurs="0" maxOccurs="1"/>
            <xsd:element name="Complemento" type="tsComplementoEndereco" minOccurs="0" maxOccurs="1"/>
            <xsd:element name="Bairro" type="tsBairro" minOccurs="0" maxOccurs="1"/>
            <xsd:element name="CodigoMunicipio" type="tsCodigoMunicipioIbge" minOccurs="0" maxOccurs="1"/>
            <xsd:element name="Uf" type="tsUf" minOccurs="0" maxOccurs="1"/>
            <xsd:element name="Cep" type="tsCepString" minOccurs="0" maxOccurs="1"/>
            <xsd:element name="CodigoPais" type="tsCodigoPaisBacen" minOccurs="0" maxOccurs="1" />
            <xsd:element name="Municipio" type="tsMunicipio" minOccurs="0" maxOccurs="1" />
        </xsd:sequence>
    </xsd:complexType>

    <xsd:complexType name="tcDadosServico">
        <xsd:sequence>
            <xsd:element name="Valores" type="tcValores" minOccurs="1" maxOccurs="1"/>
			<xsd:element name="IssConstrucaoCivil" minOccurs="0" maxOccurs="1">
                <xsd:complexType>
                    <xsd:sequence>
                        <xsd:element name="Deducoes" maxOccurs="unbounded" type="tcDeducoes" minOccurs="1"/>
                    </xsd:sequence>
                </xsd:complexType>
            </xsd:element>                                       
            <xsd:element name="ItemListaServico" type="tsItemListaServico" minOccurs="1" maxOccurs="1"/>
            <xsd:element name="Discriminacao" type="tsDiscriminacao" minOccurs="1" maxOccurs="1"/>
            <xsd:element name="InformacoesComplementares" type="tsInformacoesComplementares" minOccurs="0" maxOccurs="1"/>
            <xsd:element name="CodigoMunicipio" type="tsCodigoMunicipioIbge" minOccurs="1" maxOccurs="1"/>
            <xsd:element name="CodigoPais" type="tsCodigoPaisBacen" minOccurs="0" maxOccurs="1" />
            <xsd:element name="CodigoMunicipioLocalPrestacao" type="tsCodigoMunicipioIbge" minOccurs="0" maxOccurs="1"/>
            <xsd:element name="DiscriminacaoServicosCartaCorrecao" type="tsDiscriminacaoServicosCC" minOccurs="0" maxOccurs="1" />
            <xsd:element name="cNBS" type="TSCodNBS" minOccurs="0" maxOccurs="1" />
        </xsd:sequence>
    </xsd:complexType>
    
    <xsd:simpleType name="TSCodNBS">
	    <xsd:annotation>
	      <xsd:documentation>
	        Código da lista de Nomenclatura Brasileira de Serviços (NBS)
	      </xsd:documentation>
	    </xsd:annotation>
        <xsd:restriction base="xsd:int">
            <xsd:totalDigits value="10"/>
        </xsd:restriction>
    </xsd:simpleType>

    <xsd:complexType name="tcDadosTomador">
        <xsd:sequence>
            <xsd:element name="IdentificacaoTomador" type="tcIdentificacaoTomador" minOccurs="0" maxOccurs="1"/>
            <xsd:element name="InscricaoMunicipal" type="tsInscricaoMunicipal" minOccurs="0" maxOccurs="1"/>
            <xsd:element name="RazaoSocial" type="tsRazaoSocial" minOccurs="0" maxOccurs="1"/>
            <xsd:element name="NomeFantasia" type="tsNomeFantasia" minOccurs="0" maxOccurs="1"/>
            <xsd:element name="Endereco" type="tcEndereco" minOccurs="0" maxOccurs="1"/>
            <xsd:element name="Contato" type="tcContato" minOccurs="0" maxOccurs="1"/>
        </xsd:sequence>
    </xsd:complexType>

    <xsd:simpleType name="tsStatusRps">
        <xsd:restriction base="xsd:byte">
            <xsd:pattern value="1|2"/>
        </xsd:restriction>
    </xsd:simpleType>

    <xsd:complexType name="tcIdentificacaoIntermediarioServico">
        <xsd:sequence>
            <xsd:element name="TipoIntermediario" type="tsTipoIntermediario" minOccurs="0" maxOccurs="1"/>
            <xsd:element name="RazaoSocial" type="tsRazaoSocial" minOccurs="1" maxOccurs="1"/>
            <xsd:choice minOccurs="1" maxOccurs="1">
	            <xsd:element name="CpfCnpj" type="tcCpfCnpj"/>
	            <xsd:element name="NIF" type="tsNif"/>
        	</xsd:choice>
            <xsd:element name="InscricaoMunicipal" type="tsInscricaoMunicipal" minOccurs="0" maxOccurs="1"/>
            <xsd:element name="Endereco" type="tcEnderecoIntermediario" minOccurs="0" maxOccurs="1"/>
        </xsd:sequence>
    </xsd:complexType>
    
	<xsd:complexType name="tcEnderecoIntermediario">
        <xsd:sequence>
            <xsd:element name="Cep" type="tsCep" minOccurs="0" maxOccurs="1"/>
            <xsd:element name="Logradouro" type="tsEndereco" minOccurs="0" maxOccurs="1"/>
            <xsd:element name="Numero" type="tsNumeroEndereco" minOccurs="0" maxOccurs="1"/>
            <xsd:element name="Bairro" type="tsBairro" minOccurs="0" maxOccurs="1"/>
            <xsd:element name="Complemento" type="tsComplementoEndereco" minOccurs="0" maxOccurs="1"/>
            <xsd:element name="CodigoPais" type="tsCodigoPaisBacen" minOccurs="0" maxOccurs="1" />
            <xsd:element name="Uf" type="tsUf" minOccurs="0" maxOccurs="1"/>
            <xsd:element name="DescricaoMunicipio" type="tsDescricaoMunicipio" minOccurs="0" maxOccurs="1"/>
            <xsd:element name="CodigoMunicipio" type="tsCodigoMunicipioIbge" minOccurs="0" maxOccurs="1"/>
        </xsd:sequence>
    </xsd:complexType>
    
    <xsd:complexType name="tcIdentificacaoAtividadeEventos">
        <xsd:sequence>
            <xsd:element name="TipoAtividadeEvento" type="tsTipoEvento" minOccurs="1" maxOccurs="1"/>
            <xsd:element name="NomeEvento" type="tsRazaoSocial" minOccurs="1" maxOccurs="1"/>
            <xsd:element name="DataInicio" type="xsd:date" minOccurs="0" maxOccurs="1"/>
            <xsd:element name="DataFim" type="xsd:date" minOccurs="0" maxOccurs="1"/>
            <xsd:element name="Endereco" type="tcEnderecoAtividadeEventos" minOccurs="0" maxOccurs="1"/>
        </xsd:sequence>
    </xsd:complexType>
    
	<xsd:complexType name="tcEnderecoAtividadeEventos">
        <xsd:sequence>
            <xsd:element name="Cep" type="tsCep" minOccurs="0" maxOccurs="1"/>
            <xsd:element name="Logradouro" type="tsEndereco" minOccurs="0" maxOccurs="1"/>
            <xsd:element name="Numero" type="tsNumeroEndereco" minOccurs="0" maxOccurs="1"/>
            <xsd:element name="Bairro" type="tsBairro" minOccurs="0" maxOccurs="1"/>
            <xsd:element name="Complemento" type="tsComplementoEndereco" minOccurs="0" maxOccurs="1"/>
            <xsd:element name="CodigoPais" type="tsCodigoPaisBacen" minOccurs="0" maxOccurs="1" />
            <xsd:element name="Uf" type="tsUf" minOccurs="0" maxOccurs="1"/>
            <xsd:element name="DescricaoMunicipio" type="tsDescricaoMunicipio" minOccurs="0" maxOccurs="1"/>
            <xsd:element name="CodigoMunicipio" type="tsCodigoMunicipioIbge" minOccurs="0" maxOccurs="1"/>
        </xsd:sequence>
    </xsd:complexType>
    
	<xsd:complexType name="tcDestinatario">
	    <xsd:sequence>
	        <xsd:element name="TipoDestinatario" type="tsTipoContribuinte" minOccurs="0" maxOccurs="1"/>
	        <xsd:element name="Identificacao" type="tsIdentificacao" minOccurs="0" maxOccurs="1"/>
	        <xsd:element name="TipoServico" type="tsTipoDestinatarioServico" minOccurs="0" maxOccurs="1"/>
	        <xsd:element name="Nome" type="tsRazaoSocial" minOccurs="0" maxOccurs="1"/>
	        <xsd:element name="Fone" type="tsTelefone" minOccurs="0" maxOccurs="1"/>
	        <xsd:element name="Email" type="tsEmail" minOccurs="0" maxOccurs="1"/>
	        <xsd:element name="Endereco" type="tcEnderecoDestinatario" minOccurs="0" maxOccurs="1"/>
	    </xsd:sequence>
	</xsd:complexType>
    
   	<xsd:complexType name="tcEnderecoDestinatario">
        <xsd:sequence>
            <xsd:element name="Cep" type="tsCep" minOccurs="0" maxOccurs="1"/>
            <xsd:element name="Logradouro" type="tsEndereco" minOccurs="0" maxOccurs="1"/>
            <xsd:element name="Numero" type="tsNumeroEndereco" minOccurs="0" maxOccurs="1"/>
            <xsd:element name="Bairro" type="tsBairro" minOccurs="0" maxOccurs="1"/>
            <xsd:element name="Complemento" type="tsComplementoEndereco" minOccurs="0" maxOccurs="1"/>
            <xsd:element name="CodigoPais" type="tsCodigoPaisBacen" minOccurs="0" maxOccurs="1" />
            <xsd:element name="Uf" type="tsUf" minOccurs="0" maxOccurs="1"/>
            <xsd:element name="DescricaoMunicipio" type="tsDescricaoMunicipio" minOccurs="0" maxOccurs="1"/>
            <xsd:element name="CodigoMunicipio" type="tsCodigoMunicipioIbge" minOccurs="0" maxOccurs="1"/>
        </xsd:sequence>
    </xsd:complexType>
    
    <xsd:complexType name="tcImovel">
	    <xsd:sequence>
	        <xsd:element name="TipoImovel" type="tsTipoImovel" minOccurs="1" maxOccurs="1"/>
	        <xsd:element name="InscImob" type="tsInscricaoImobiliaria" minOccurs="0" maxOccurs="1"/>
	        <xsd:element name="CIB" type="tsCib" minOccurs="0" maxOccurs="1"/>
	        <xsd:element name="Endereco" type="tcEnderecoImovel" minOccurs="0" maxOccurs="1"/>
	    </xsd:sequence>
	</xsd:complexType>
    
    
	<xsd:complexType name="tcEnderecoImovel">
        <xsd:sequence>
            <xsd:element name="Cep" type="tsCep" minOccurs="0" maxOccurs="1"/>
            <xsd:element name="Logradouro" type="tsEndereco" minOccurs="0" maxOccurs="1"/>
            <xsd:element name="Numero" type="tsNumeroEndereco" minOccurs="0" maxOccurs="1"/>
            <xsd:element name="Bairro" type="tsBairro" minOccurs="0" maxOccurs="1"/>
            <xsd:element name="Complemento" type="tsComplementoEndereco" minOccurs="0" maxOccurs="1"/>
            <xsd:element name="CodigoPais" type="tsCodigoPaisBacen" minOccurs="0" maxOccurs="1" />
            <xsd:element name="Uf" type="tsUf" minOccurs="0" maxOccurs="1"/>
            <xsd:element name="DescricaoMunicipio" type="tsDescricaoMunicipio" minOccurs="0" maxOccurs="1"/>
            <xsd:element name="CodigoMunicipio" type="tsCodigoMunicipioIbge" minOccurs="0" maxOccurs="1"/>
        </xsd:sequence>
    </xsd:complexType>

    <xsd:simpleType name="tsNaturezaOperacao">
        <xsd:restriction base="xsd:int">
        </xsd:restriction>
    </xsd:simpleType>

    <xsd:element name="ConsultarNfseResposta">
        <xsd:complexType>
            <xsd:choice>
                <xsd:element name="ListaNfse" minOccurs="1" maxOccurs="1">
                    <xsd:complexType>
                        <xsd:sequence>
                            <xsd:element name="CompNfse" maxOccurs="unbounded" type="tcCompNfse" minOccurs="0"/>
			                <xsd:element name="ProximaPagina" type="tsPagina" minOccurs="0" maxOccurs="1"/>
                        </xsd:sequence>
                    </xsd:complexType>
                </xsd:element>
                <xsd:element ref="ListaMensagemRetorno" minOccurs="1" maxOccurs="1"/>
            </xsd:choice>
        </xsd:complexType>
    </xsd:element>

    <xsd:element name="ListaMensagemRetorno">
        <xsd:complexType>
            <xsd:sequence>
                <xsd:element name="MensagemRetorno" type="tcMensagemRetorno" minOccurs="1" maxOccurs="unbounded"/>
            </xsd:sequence>
        </xsd:complexType>
    </xsd:element>

    <xsd:complexType name="tcMensagemRetorno">
        <xsd:sequence>
            <xsd:element name="Codigo" type="tsCodigoMensagemAlerta" minOccurs="1" maxOccurs="1"/>
            <xsd:element name="Mensagem" type="tsDescricaoMensagemAlerta" minOccurs="1" maxOccurs="1"/>
            <xsd:element name="Correcao" type="tsDescricaoMensagemAlerta" minOccurs="0"/>
        </xsd:sequence>
    </xsd:complexType>

    <xsd:simpleType name="tsCodigoMensagemAlerta">
        <xsd:restriction base="xsd:string">
            <xsd:maxLength value="4"/>
            <xsd:minLength value="1"/>
            <xsd:whiteSpace value="collapse"/>
        </xsd:restriction>
    </xsd:simpleType>

    <xsd:simpleType name="tsDescricaoMensagemAlerta">
        <xsd:restriction base="xsd:string">
            <xsd:maxLength value="200"/>
            <xsd:minLength value="1"/>
            <xsd:whiteSpace value="collapse"/>
        </xsd:restriction>
    </xsd:simpleType>

    <xsd:complexType name="tcCompNfse">
        <xsd:sequence>
            <xsd:element name="Nfse" type="tcNfse" minOccurs="1" maxOccurs="1"/>
            <xsd:element name="NfseCancelamento" type="tcCancelamentoNfse" minOccurs="0" maxOccurs="1"/>
            <xsd:element name="NfseSubstituicao" type="tcSubstituicaoNfse" minOccurs="0" maxOccurs="1"/>
            <xsd:element name="ListaCorrecao" minOccurs="0" maxOccurs="1">
                <xsd:complexType>
                    <xsd:sequence>
                        <xsd:element name="CartaCorrecao" type="tcCartaCorrecao" maxOccurs="unbounded" minOccurs="0"/>
                    </xsd:sequence>
                </xsd:complexType>
            </xsd:element>
        </xsd:sequence>
    </xsd:complexType>

    <xsd:complexType name="tcNfse">
        <xsd:sequence>
            <xsd:element name="InfNfse" type="tcInfNfse" minOccurs="1" maxOccurs="1"/>
        </xsd:sequence>
    </xsd:complexType>

    <xsd:complexType name="tcInfNfse">
        <xsd:sequence>
            <xsd:element name="Numero" type="tsNumeroNfse" minOccurs="1" maxOccurs="1"/>
            <xsd:element name="Serie" type="tsSerie" minOccurs="0" maxOccurs="1"/>
            <xsd:element name="CodigoVerificacao" type="tsCodigoVerificacao" minOccurs="1" maxOccurs="1"/>
            <xsd:element name="DataEmissao" type="xsd:dateTime" minOccurs="1" maxOccurs="1"/>
            <xsd:element name="IdentificacaoRps" minOccurs="0" type="tcIdentificacaoRps" maxOccurs="1"/>
            <xsd:element name="DataEmissaoRps" type="xsd:date" minOccurs="0" maxOccurs="1"/>
            <xsd:element name="NaturezaOperacao" type="tsNaturezaOperacao" minOccurs="1" maxOccurs="1"/>
            <xsd:element name="OptanteSimplesNacional" type="tsSimNao" minOccurs="1" maxOccurs="1"/>
            <xsd:element name="IncentivadorCultural" type="tsSimNao" minOccurs="1" maxOccurs="1"/>
            <xsd:element name="Competencia" type="xsd:gYearMonth" minOccurs="1" maxOccurs="1"/>
            <xsd:element name="NfseSubstituida" type="tsNumeroNfse" minOccurs="0" maxOccurs="1"/>
            <xsd:element name="OutrasInformacoes" type="tsOutrasInformacoes" minOccurs="0" maxOccurs="1"/>
            <xsd:element name="Servico" type="tcDadosServico" minOccurs="1" maxOccurs="1"/>
            <xsd:element name="PrestadorServico" type="tcDadosPrestador" minOccurs="1" maxOccurs="1"/>
            <xsd:element name="TomadorServico" type="tcDadosTomador" minOccurs="0" maxOccurs="1"/>
            <xsd:element name="IntermediarioServico" type="tcIdentificacaoIntermediarioServico" minOccurs="0" maxOccurs="1"/>
            <xsd:element name="OrgaoGerador" type="tcIdentificacaoOrgaoGerador" minOccurs="1" maxOccurs="1"/>
            <xsd:element name="CondicaoPagamento" type="tcCondicoesPagamentos" minOccurs="0" maxOccurs="1"/>
            <xsd:element name="ConstrucaoCivil" type="tcConstrucaoCivil" minOccurs="0" maxOccurs="1"/>
            <xsd:element name="LinkVisualizacaoNfse" type="tsLinkVisualizacaoNfse" minOccurs="0" maxOccurs="1"/>
        </xsd:sequence>
        <xsd:attribute name="id" type="tsIdTag"/>
    </xsd:complexType>

    <xsd:complexType name="tcCancelamentoNfse">
        <xsd:sequence>
            <xsd:element name="Confirmacao" type="tcConfirmacaoCancelamento" minOccurs="1" maxOccurs="1"/>
            <xsd:element ref="dsig:Signature" minOccurs="0" maxOccurs="1"/>
        </xsd:sequence>
    </xsd:complexType>

    <xsd:complexType name="tcConfirmacaoCancelamento">
        <xsd:sequence>
            <xsd:element name="Pedido" type="tcPedidoCancelamento" minOccurs="1" maxOccurs="1"/>
            <xsd:element name="DataHoraCancelamento" type="xsd:dateTime" minOccurs="1" maxOccurs="1"/>
        </xsd:sequence>
        <xsd:attribute name="id" type="tsIdTag"/>
    </xsd:complexType>

    <xsd:complexType name="tcPedidoCancelamento">
        <xsd:sequence>
            <xsd:element name="InfPedidoCancelamento" type="tcInfPedidoCancelamento" minOccurs="1" maxOccurs="1"/>
            <xsd:element ref="dsig:Signature" minOccurs="1" maxOccurs="1"/>
        </xsd:sequence>
    </xsd:complexType>

    <xsd:complexType name="tcInfPedidoCancelamento">
        <xsd:sequence>
            <xsd:element name="IdentificacaoNfse" type="tcIdentificacaoNfse" minOccurs="1" maxOccurs="1"/>
            <xsd:element name="CodigoCancelamento" type="tsCodigoCancelamentoNfse" minOccurs="1" maxOccurs="1"/>
            <xsd:element name="MotivoCancelamento" type="tsMotivoCancelamentoNfse" minOccurs="0" maxOccurs="1"/>
        </xsd:sequence>
        <xsd:attribute name="id" type="tsIdTag"/>
    </xsd:complexType>

    <xsd:complexType name="tcIdentificacaoNfse">
        <xsd:sequence>
            <xsd:element name="Numero" type="tsNumeroNfse" minOccurs="1" maxOccurs="1"/>
            <xsd:element name="Cnpj" type="tsCnpj" minOccurs="1" maxOccurs="1"/>
            <xsd:element name="InscricaoMunicipal" type="tsInscricaoMunicipal" minOccurs="0" maxOccurs="1"/>
            <xsd:element name="CodigoMunicipio" type="tsCodigoMunicipioIbge" minOccurs="1" maxOccurs="1"/>
            <xsd:element name="CodigoVerificacao" type="tsCodigoVerificacao" minOccurs="0" maxOccurs="1"/>
        </xsd:sequence>
    </xsd:complexType>

    <xsd:complexType name="tcSubstituicaoNfse">
        <xsd:sequence>
            <xsd:element name="SubstituicaoNfse" type="tcInfSubstituicaoNfse" minOccurs="1" maxOccurs="1"/>
        </xsd:sequence>
    </xsd:complexType>

    <xsd:complexType name="tcInfSubstituicaoNfse">
        <xsd:sequence>
            <xsd:element name="NfseSubstituidora" type="tsNumeroNfse" minOccurs="1" maxOccurs="1"/>
        </xsd:sequence>
        <xsd:attribute name="id" type="tsIdTag"/>
    </xsd:complexType>

    <xsd:simpleType name="tsNumeroNfse">
        <xsd:restriction base="xsd:nonNegativeInteger">
            <xsd:pattern value="[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]"/>
        </xsd:restriction>
    </xsd:simpleType>

    <xsd:simpleType name="tsCodigoCancelamentoNfse">
        <xsd:restriction base="xsd:string">
            <xsd:maxLength value="4"/>
            <xsd:minLength value="1"/>
            <xsd:whiteSpace value="collapse"/>
        </xsd:restriction>
    </xsd:simpleType>

    <xsd:complexType name="tcIdentificacaoOrgaoGerador">
        <xsd:sequence>
            <xsd:element name="CodigoMunicipio" type="tsCodigoMunicipioIbge" minOccurs="1" maxOccurs="1"/>
            <xsd:element name="Uf" type="tsUf" minOccurs="1" maxOccurs="1"/>
        </xsd:sequence>
    </xsd:complexType>

    <xsd:complexType name="tcDadosPrestador">
        <xsd:sequence>
            <xsd:element name="IdentificacaoPrestador" type="tcIdentificacaoPrestador" minOccurs="1" maxOccurs="1"/>
            <xsd:element name="RazaoSocial" type="tsRazaoSocial" minOccurs="1" maxOccurs="1"/>
            <xsd:element name="NomeFantasia" type="tsNomeFantasia" minOccurs="0" maxOccurs="1"/>
            <xsd:element name="Endereco" type="tcEndereco" minOccurs="1" maxOccurs="1"/>
            <xsd:element name="Contato" type="tcContato" minOccurs="0" maxOccurs="1"/>
        </xsd:sequence>
    </xsd:complexType>

    <xsd:simpleType name="tsNomeFantasia">
        <xsd:restriction base="xsd:string">
            <xsd:maxLength value="60"/>
            <xsd:minLength value="1"/>
            <xsd:whiteSpace value="collapse"/>
        </xsd:restriction>
    </xsd:simpleType>

    <xsd:simpleType name="tsOutrasInformacoes">
        <xsd:restriction base="xsd:string">
            <xsd:maxLength value="255"/>
            <xsd:minLength value="1"/>
            <xsd:whiteSpace value="collapse"/>
        </xsd:restriction>
    </xsd:simpleType>

    <xsd:simpleType name="tsCodigoVerificacao">
        <xsd:restriction base="xsd:string">
            <xsd:maxLength value="9"/>
            <xsd:minLength value="1"/>
            <xsd:whiteSpace value="collapse"/>
        </xsd:restriction>
    </xsd:simpleType>

    <xsd:simpleType name="tsCodigoPaisBacen">
        <xsd:restriction base="xsd:string">
            <xsd:maxLength value="4"/>
            <xsd:minLength value="1"/>
        </xsd:restriction>
    </xsd:simpleType>

    <xsd:simpleType name="tsSerie">
        <xsd:restriction base="xsd:string">
            <xsd:maxLength value="5"/>
            <xsd:minLength value="1"/>
            <xsd:whiteSpace value="collapse"/>
        </xsd:restriction>
    </xsd:simpleType>
	
    <xsd:simpleType name="tsSituacaoLoteRps">
        <xsd:restriction base="xsd:byte">
            <xsd:pattern value="1|2|3|4"/>
        </xsd:restriction>
    </xsd:simpleType>

    <xsd:element name="ConsultarSituacaoLoteRpsResposta">
        <xsd:complexType>
            <xsd:choice>
                <xsd:sequence>
                    <xsd:element name="NumeroLote" type="tsNumeroLote" minOccurs="1" maxOccurs="1"/>
                    <xsd:element name="Situacao" type="tsSituacaoLoteRps" minOccurs="1" maxOccurs="1"/>
                </xsd:sequence>
                <xsd:element ref="ListaMensagemRetorno" minOccurs="1" maxOccurs="1"/>
            </xsd:choice>
        </xsd:complexType>
    </xsd:element>

    <xsd:element name="EnviarLoteRpsResposta">
        <xsd:complexType>
            <xsd:choice>
                <xsd:sequence>
                    <xsd:element name="NumeroLote" type="tsNumeroLote" minOccurs="1" maxOccurs="1"/>
                    <xsd:element name="DataRecebimento" type="xsd:dateTime" minOccurs="1" maxOccurs="1"/>
                    <xsd:element name="Protocolo" type="tsNumeroProtocolo" minOccurs="1" maxOccurs="1"/>
                </xsd:sequence>
                <xsd:element ref="ListaMensagemRetorno" minOccurs="1" maxOccurs="1"/>
            </xsd:choice>
        </xsd:complexType>
    </xsd:element>

    <xsd:simpleType name="tsNumeroProtocolo">
        <xsd:restriction base="xsd:string">
            <xsd:maxLength value="50"/>
        </xsd:restriction>
    </xsd:simpleType>

    <xsd:element name="ConsultarSituacaoLoteRpsEnvio">
        <xsd:complexType>
            <xsd:sequence>
                <xsd:element name="Prestador" type="tcIdentificacaoPrestador" minOccurs="1" maxOccurs="1"/>
                <xsd:element name="Protocolo" type="tsNumeroProtocolo" minOccurs="1" maxOccurs="1"/>
                <xsd:element ref="dsig:Signature" minOccurs="1" maxOccurs="1"/>
            </xsd:sequence>
        </xsd:complexType>
    </xsd:element>

    <xsd:element name="ConsultarNfseRpsEnvio">
        <xsd:complexType>
            <xsd:sequence>
                <xsd:element name="IdentificacaoRps" type="tcIdentificacaoRps" minOccurs="1" maxOccurs="1"/>
                <xsd:element name="Prestador" type="tcIdentificacaoPrestador" minOccurs="1" maxOccurs="1"/>
                <xsd:element name="Pagina" type="tsPagina" minOccurs="0" maxOccurs="1" />
                <xsd:element ref="dsig:Signature" minOccurs="1" maxOccurs="1"/>
            </xsd:sequence>
        </xsd:complexType>
    </xsd:element>

    <xsd:element name="ConsultarLoteRpsEnvio">
        <xsd:complexType>
            <xsd:sequence>
                <xsd:element name="Prestador" type="tcIdentificacaoPrestador" minOccurs="1" maxOccurs="1"/>
                <xsd:element name="Protocolo" type="tsNumeroProtocolo" minOccurs="1" maxOccurs="1"/>
                <xsd:element name="Pagina" type="tsPagina" minOccurs="0" maxOccurs="1" />
                <xsd:element ref="dsig:Signature" minOccurs="1" maxOccurs="1"/>
            </xsd:sequence>
        </xsd:complexType>
    </xsd:element>

    <xsd:element name="ConsultarLoteRpsResposta">
        <xsd:complexType>
            <xsd:choice>
                <xsd:element name="ListaNfse" minOccurs="1" maxOccurs="1">
                    <xsd:complexType>
                        <xsd:sequence>
                            <xsd:element name="CompNfse" maxOccurs="unbounded" type="tcCompNfse" minOccurs="1"/>
                            <xsd:element name="ProximaPagina" type="tsPagina" minOccurs="0" maxOccurs="1"/>
                        </xsd:sequence>
                    </xsd:complexType>
                </xsd:element>
                <xsd:element ref="ListaMensagemRetorno" minOccurs="1" maxOccurs="1"/>
            </xsd:choice>
        </xsd:complexType>
    </xsd:element>

    <xsd:element name="CancelarNfseResposta">
        <xsd:complexType>
            <xsd:choice>
                <xsd:element name="Cancelamento" type="tcCancelamentoNfse"/>
                <xsd:element ref="ListaMensagemRetorno" minOccurs="1" maxOccurs="1"/>
            </xsd:choice>
        </xsd:complexType>
    </xsd:element>

    <xsd:element name="CancelarNfseEnvio">
        <xsd:complexType>
            <xsd:sequence>
                <xsd:element name="Pedido" type="tcPedidoCancelamento"/>
            </xsd:sequence>
        </xsd:complexType>
    </xsd:element>

    <xsd:element name="GerarNfseEnvio">
        <xsd:complexType>
            <xsd:sequence>
                <xsd:element name="Rps" type="tcRps" maxOccurs="1" minOccurs="1"></xsd:element>
            </xsd:sequence>
        </xsd:complexType>
    </xsd:element>

    <xsd:element name="GerarNfseResposta">
        <xsd:complexType>
            <xsd:choice>
                <xsd:element name="ListaNfse" minOccurs="1" maxOccurs="1">
                    <xsd:complexType>
                        <xsd:sequence>
                            <xsd:element name="CompNfse" maxOccurs="unbounded" type="tcCompNfse" minOccurs="0"/>
                        </xsd:sequence>
                    </xsd:complexType>
                </xsd:element>
                <xsd:element ref="ListaMensagemRetorno" minOccurs="1" maxOccurs="1"/>
            </xsd:choice>
        </xsd:complexType>
    </xsd:element>

    <xsd:element name="ConsultarNfseFaixaEnvio">
        <xsd:complexType>
            <xsd:sequence>
                <xsd:element name="Prestador" type="tcIdentificacaoPrestador" minOccurs="1" maxOccurs="1" />
                <xsd:element name="Faixa" minOccurs="1" maxOccurs="1">
                    <xsd:complexType>
                        <xsd:sequence>
                            <xsd:element name="NumeroNfseInicial" type="tsNumeroNfse" minOccurs="1" maxOccurs="1" />
                            <xsd:element name="NumeroNfseFinal" type="tsNumeroNfse" minOccurs="0" maxOccurs="1" />
                        </xsd:sequence>
                    </xsd:complexType>
                </xsd:element>
                <xsd:element name="Pagina" type="tsPagina" minOccurs="0" maxOccurs="1" />
                <xsd:element ref="dsig:Signature" minOccurs="1" maxOccurs="1"/>
            </xsd:sequence>
        </xsd:complexType>
    </xsd:element>

    <xsd:element name="ConsultarNfseFaixaResposta">
        <xsd:complexType>
            <xsd:choice>
                <xsd:element name="ListaNfse" minOccurs="1" maxOccurs="1">
                    <xsd:complexType>
                        <xsd:sequence>
                            <xsd:element name="CompNfse" maxOccurs="unbounded" type="tcCompNfse" minOccurs="0"/>
                            <xsd:element name="ProximaPagina" type="tsPagina" minOccurs="0" maxOccurs="1"/>
                        </xsd:sequence>
                    </xsd:complexType>
                </xsd:element>
                <xsd:element ref="ListaMensagemRetorno" minOccurs="1" maxOccurs="1"/>
            </xsd:choice>
        </xsd:complexType>
    </xsd:element>

    <xsd:element name="ConsultarNfsePeriodoEnvio">
        <xsd:complexType>
            <xsd:sequence>
                <xsd:element name="Prestador" type="tcIdentificacaoPrestador" minOccurs="1" maxOccurs="1" />
                <xsd:element name="Data" minOccurs="1" maxOccurs="1">
                    <xsd:complexType>
                        <xsd:sequence>
                            <xsd:element name="DataInicial" type="xsd:date" minOccurs="1" maxOccurs="1" />
                            <xsd:element name="DataFinal" type="xsd:date" minOccurs="0" maxOccurs="1" />
                        </xsd:sequence>
                    </xsd:complexType>
                </xsd:element>
                <xsd:element name="Pagina" type="tsPagina" minOccurs="0" maxOccurs="1" />
                <xsd:element ref="dsig:Signature" minOccurs="1" maxOccurs="1"/>
            </xsd:sequence>
        </xsd:complexType>
    </xsd:element>

    <xsd:element name="ConsultarNfsePeriodoResposta">
        <xsd:complexType>
            <xsd:choice>
                <xsd:element name="ListaNfse" minOccurs="1" maxOccurs="1">
                    <xsd:complexType>
                        <xsd:sequence>
                            <xsd:element name="CompNfse" maxOccurs="unbounded" type="tcCompNfse" minOccurs="0"/>
                            <xsd:element name="ProximaPagina" type="tsPagina" minOccurs="0" maxOccurs="1"/>
                        </xsd:sequence>
                    </xsd:complexType>
                </xsd:element>
                <xsd:element ref="ListaMensagemRetorno" minOccurs="1" maxOccurs="1"/>
            </xsd:choice>
        </xsd:complexType>
    </xsd:element>

    <xsd:element name="SubstituirNfseEnvio">
        <xsd:complexType>
            <xsd:sequence>
                <xsd:element name="SubstituicaoNfse" minOccurs="1" maxOccurs="1">
                    <xsd:complexType>
                        <xsd:sequence>
                            <xsd:element name="Pedido" type="tcPedidoCancelamento" />
                            <xsd:element name="Rps" type="tcRps" maxOccurs="1" minOccurs="1"/>
                        </xsd:sequence>
                        <xsd:attribute name="id" type="tsIdTag" />
                    </xsd:complexType>
                </xsd:element>
                <xsd:element ref="dsig:Signature" minOccurs="1" maxOccurs="1" />
            </xsd:sequence>
        </xsd:complexType>
    </xsd:element>
    
    <xsd:element name="SubstituirNfseResposta">
        <xsd:complexType>
            <xsd:choice>
                <xsd:element name="RetSubstituicao">
                    <xsd:complexType>
                        <xsd:sequence>
                            <xsd:element name="NfseSubstituida">
                                <xsd:complexType>
                                    <xsd:sequence>
                                        <xsd:element name="CompNfse" maxOccurs="1" type="tcCompNfse" minOccurs="1"/>
                                    </xsd:sequence>
                                </xsd:complexType>
                            </xsd:element>
                            <xsd:element name="NfseSubstituidora">
                                <xsd:complexType>
                                    <xsd:sequence>
                                        <xsd:element name="CompNfse" maxOccurs="1" type="tcCompNfse" minOccurs="1"/>
                                    </xsd:sequence>
                                </xsd:complexType>
                            </xsd:element>
                        </xsd:sequence>
                    </xsd:complexType>
                </xsd:element>
                <xsd:element ref="ListaMensagemRetorno" minOccurs="1" maxOccurs="1"/>
            </xsd:choice>
        </xsd:complexType>
    </xsd:element>

    <xsd:simpleType name="tsNumeroCartaCorrecao">
        <xsd:restriction base="xsd:nonNegativeInteger">
            <xsd:totalDigits value="10"/>
        </xsd:restriction>
    </xsd:simpleType>

    <xsd:complexType name="tcCartaCorrecao">
        <xsd:sequence>
            <xsd:element name="NumeroCartaCorrecao" type="tsNumeroCartaCorrecao" minOccurs="1" maxOccurs="1"/>
            <xsd:element name="Oficial" type="tsSimNao" minOccurs="1" maxOccurs="1"/>
            <xsd:element name="DataDeclaracao" type="xsd:dateTime" minOccurs="1" maxOccurs="1"/>
            <xsd:element name="TomadorServico" type="tcDadosTomador" minOccurs="0" maxOccurs="1"/>
            <xsd:element name="IntermediarioServico" type="tcIdentificacaoIntermediarioServico" minOccurs="0" maxOccurs="1"/>
            <xsd:element name="Discriminacao" type="tsDiscriminacao" minOccurs="0" maxOccurs="1"/>			
            <xsd:element name="Valores" type="tcValoresCartaCorrecao" minOccurs="0" maxOccurs="1"/>
            <xsd:element name="Observacao" type="tsObservacao" minOccurs="0" maxOccurs="1"/>
        </xsd:sequence>
    </xsd:complexType>

    <xsd:complexType name="tcPedidoCartaCorrecao">
        <xsd:sequence>
            <xsd:element name="InfPedidoCartaCorrecao" type="tcInfPedidoCartaCorrecao" minOccurs="1" maxOccurs="1"/>
            <xsd:element ref="dsig:Signature" minOccurs="1" maxOccurs="1"/>
        </xsd:sequence>
    </xsd:complexType>

    <xsd:complexType name="tcInfPedidoCartaCorrecao">
        <xsd:sequence>
            <xsd:element name="IdentificacaoNfse" type="tcIdentificacaoNfse" minOccurs="1" maxOccurs="1"/>
            <xsd:element name="TomadorServico" type="tcDadosTomador" minOccurs="0" maxOccurs="1"/>
            <xsd:element name="IntermediarioServico" type="tcIdentificacaoIntermediarioServico" minOccurs="0" maxOccurs="1"/>
            <xsd:element name="Discriminacao" type="tsDiscriminacao" minOccurs="0" maxOccurs="1"/>
            <xsd:element name="InformacoesComplementares" type="tsInformacoesComplementares" minOccurs="0" maxOccurs="1"/>
            <xsd:element name="Valores" type="tcValoresCartaCorrecao" minOccurs="0" maxOccurs="1"/>
            <xsd:element name="CondicaoPagamento" type="tcCondicoesPagamentos" minOccurs="0" maxOccurs="1"/>
            <xsd:element name="ConstrucaoCivil" type="tcConstrucaoCivil" minOccurs="0" maxOccurs="1"/>
        </xsd:sequence>
        <xsd:attribute name="id" type="tsIdTag"/>
    </xsd:complexType>

    <xsd:element name="CartaCorrecaoNfseEnvio">
        <xsd:complexType>
            <xsd:sequence>
                <xsd:element name="Pedido" type="tcPedidoCartaCorrecao"/>
            </xsd:sequence>
        </xsd:complexType>
    </xsd:element>
    
    <xsd:element name="CartaCorrecaoNfseResposta">
        <xsd:complexType>
            <xsd:choice>
                <xsd:element name="CompNfse" type="tcCompNfse" minOccurs="1" maxOccurs="1"/>
                <xsd:element ref="ListaMensagemRetorno" minOccurs="1" maxOccurs="1"/>
            </xsd:choice>
        </xsd:complexType>
    </xsd:element>
   
    <xsd:complexType name="tcConsultaNfseRecebida">
        <xsd:sequence>
            <xsd:element name="IdentificacaoTomador" type="tcIdentificacaoTomador" minOccurs="1" maxOccurs="1"/>
            <xsd:choice>
                <xsd:element name="DataNfse" type="tcDataNfseRecebida" minOccurs="1" maxOccurs="1"/>
                <xsd:element name="DataRps" type="tcDataRpsRecebida" minOccurs="1" maxOccurs="1"/>
            </xsd:choice>
            <xsd:element name="Pagina" type="tsPagina" minOccurs="0" maxOccurs="1" />
        </xsd:sequence>
        <xsd:attribute name="id" type="tsIdTag"/>
    </xsd:complexType>  
    
    <xsd:complexType name="tcDataNfseRecebida">
        <xsd:sequence>
            <xsd:element name="Inicial" type="xsd:date" minOccurs="1" maxOccurs="1"/>
            <xsd:element name="Final" type="xsd:date" minOccurs="1" maxOccurs="1"/>
        </xsd:sequence>
    </xsd:complexType>  
    
    <xsd:complexType name="tcDataRpsRecebida">
        <xsd:sequence>
            <xsd:element name="Inicial" type="xsd:date" minOccurs="1" maxOccurs="1"/>
            <xsd:element name="Final" type="xsd:date" minOccurs="1" maxOccurs="1"/>
        </xsd:sequence>
    </xsd:complexType>  

    <xsd:element name="ConsultaNfseRecebidaEnvio">
        <xsd:complexType>
            <xsd:sequence>
                <xsd:element name="ConsultaNfseRecebida" type="tcConsultaNfseRecebida" minOccurs="1" maxOccurs="1"/>
                <xsd:element ref="dsig:Signature" minOccurs="1" maxOccurs="1"/>
            </xsd:sequence>
        </xsd:complexType>
    </xsd:element>
    
    <xsd:element name="ConsultaNfseRecebidaResposta">
        <xsd:complexType>
            <xsd:choice>
                <xsd:element name="ListaNfse" minOccurs="1" maxOccurs="1">
                    <xsd:complexType>
                        <xsd:sequence>
                            <xsd:element name="CompNfse" maxOccurs="unbounded" type="tcCompNfse" minOccurs="0"/>
                            <xsd:element name="ProximaPagina" type="tsPagina" minOccurs="0" maxOccurs="1"/>
                        </xsd:sequence>
                    </xsd:complexType>
                </xsd:element>
                <xsd:element ref="ListaMensagemRetorno" minOccurs="1" maxOccurs="1"/>
            </xsd:choice>
        </xsd:complexType>
    </xsd:element>    

    <xsd:simpleType name="tsPagina">
        <xsd:restriction base="xsd:nonNegativeInteger">
            <xsd:minInclusive value="1" />
            <xsd:maxInclusive value="999999" />
        </xsd:restriction>
    </xsd:simpleType>    

</xsd:schema>