<?xml version="1.0"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <xsd:element name="NFEEletronica">
    <xsd:complexType>
      <xsd:sequence>
        <xsd:element name="Header" minOccurs="1" maxOccurs="1">
          <xsd:complexType>
            <xsd:sequence>
              <xsd:element name="Versao" fixed="002">
                <xsd:annotation>
                  <xsd:documentation>Identifica a versão do layout - Fixo 002</xsd:documentation>
                </xsd:annotation>
              </xsd:element>
              <xsd:element name="CNPJCPFPrestador">
                <xsd:annotation>
                  <xsd:documentation>CNPJ / CPF do emissor da Nota Fiscal (sem máscara)</xsd:documentation>
                </xsd:annotation>
                <xsd:simpleType>
                  <xsd:restriction base="xsd:string">
                    <xsd:minLength fixed="true" value="11"></xsd:minLength>
                    <xsd:maxLength fixed="true" value="14"></xsd:maxLength>
                  </xsd:restriction>
                </xsd:simpleType>
              </xsd:element>
              <xsd:element name="Chave">
                <xsd:annotation>
                  <xsd:documentation>Chave identificadora da empresa adquirida pelo sistema de ISS ELetrônico</xsd:documentation>
                </xsd:annotation>
                <xsd:simpleType>
                  <xsd:restriction base="xsd:string">
                    <xsd:length value="48"></xsd:length>
                  </xsd:restriction>
                </xsd:simpleType>
              </xsd:element>
            </xsd:sequence>
          </xsd:complexType>
        </xsd:element>
        <xsd:element name="DadosNotaFiscal" minOccurs="1" maxOccurs="20">
          <xsd:complexType>
            <xsd:sequence>
              <xsd:element name="ID" type="xsd:positiveInteger">
                <xsd:annotation>
                  <xsd:documentation>Identificador do Registro (RPS)</xsd:documentation>
                </xsd:annotation>
              </xsd:element>
              <xsd:element name="NumeroNF" type="xsd:decimal" fixed="0000000000">
                <xsd:annotation>
                  <xsd:documentation></xsd:documentation>
                </xsd:annotation>
              </xsd:element>
              <xsd:element name="SituacaoNF" type="xsd:string" fixed="N">
                <xsd:annotation>
                  <xsd:documentation>
                    Situação da Nota Fiscal
                    N - para Nota Normal
                  </xsd:documentation>
                </xsd:annotation>
              </xsd:element>
              <xsd:element name="TipoNF" type="xsd:string" fixed="P">
                <xsd:annotation>
                  <xsd:documentation>
                    Tipo da Nota Fiscal
                    P - para Serviço Prestado
                  </xsd:documentation>
                </xsd:annotation>
              </xsd:element>
              <xsd:element name="Emissao" type="xsd:date" fixed="1900-01-01">
                <xsd:annotation>
                  <xsd:documentation>Data de Emissão da Nota Fiscal (*não informar)</xsd:documentation>
                </xsd:annotation>
              </xsd:element>
              <xsd:element name="CNPJCPFTomador">
                <xsd:annotation>
                  <xsd:documentation>CNPJ / CPF do Tomador de Serviço (sem máscara)</xsd:documentation>
                </xsd:annotation>
                <xsd:simpleType>
                  <xsd:restriction base="xsd:string">
                    <xsd:minLength fixed="true" value="11"></xsd:minLength>
                    <xsd:maxLength fixed="true" value="14"></xsd:maxLength>
                  </xsd:restriction>
                </xsd:simpleType>
              </xsd:element>
              <xsd:element name="NomeTomador">
                <xsd:annotation>
                  <xsd:documentation>Nome ou Razão Social do Tomador de Serviço</xsd:documentation>
                </xsd:annotation>
                <xsd:simpleType>
                  <xsd:restriction base="xsd:string">
                    <xsd:minLength value="0"></xsd:minLength>
                    <xsd:maxLength value="60"></xsd:maxLength>
                  </xsd:restriction>
                </xsd:simpleType>
              </xsd:element>
              <xsd:element name="UFTomador">
                <xsd:annotation>
                  <xsd:documentation>Sigla do Estado do Tomador de Serviço</xsd:documentation>
                </xsd:annotation>
                <xsd:simpleType>
                  <xsd:restriction base="xsd:string">
                    <xsd:enumeration value=""></xsd:enumeration>
                    <xsd:enumeration value="AC"></xsd:enumeration>
                    <xsd:enumeration value="AL"></xsd:enumeration>
                    <xsd:enumeration value="AM"></xsd:enumeration>
                    <xsd:enumeration value="AP"></xsd:enumeration>
                    <xsd:enumeration value="BA"></xsd:enumeration>
                    <xsd:enumeration value="CE"></xsd:enumeration>
                    <xsd:enumeration value="DF"></xsd:enumeration>
                    <xsd:enumeration value="ES"></xsd:enumeration>
                    <xsd:enumeration value="GO"></xsd:enumeration>
                    <xsd:enumeration value="MA"></xsd:enumeration>
                    <xsd:enumeration value="MG"></xsd:enumeration>
                    <xsd:enumeration value="MS"></xsd:enumeration>
                    <xsd:enumeration value="MT"></xsd:enumeration>
                    <xsd:enumeration value="PA"></xsd:enumeration>
                    <xsd:enumeration value="PB"></xsd:enumeration>
                    <xsd:enumeration value="PE"></xsd:enumeration>
                    <xsd:enumeration value="PI"></xsd:enumeration>
                    <xsd:enumeration value="PR"></xsd:enumeration>
                    <xsd:enumeration value="RJ"></xsd:enumeration>
                    <xsd:enumeration value="RN"></xsd:enumeration>
                    <xsd:enumeration value="RO"></xsd:enumeration>
                    <xsd:enumeration value="RR"></xsd:enumeration>
                    <xsd:enumeration value="RS"></xsd:enumeration>
                    <xsd:enumeration value="SC"></xsd:enumeration>
                    <xsd:enumeration value="SE"></xsd:enumeration>
                    <xsd:enumeration value="SP"></xsd:enumeration>
                    <xsd:enumeration value="TO"></xsd:enumeration>
                  </xsd:restriction>
                </xsd:simpleType>
              </xsd:element>
              <xsd:element name="CidadeTomador">
                <xsd:annotation>
                  <xsd:documentation>Código do Município na Tabela IBGE do Tomador de Serviço</xsd:documentation>
                </xsd:annotation>
                <xsd:simpleType>
                  <xsd:restriction base="xsd:int">
                    <xsd:pattern value="[0-9]{7}"></xsd:pattern>
                  </xsd:restriction>
                </xsd:simpleType>
              </xsd:element>
              <xsd:element name="EnderecoTomador">
                <xsd:annotation>
                  <xsd:documentation>Endereço do Tomador de Serviço</xsd:documentation>
                </xsd:annotation>
                <xsd:simpleType>
                  <xsd:restriction base="xsd:string">
                    <xsd:minLength value="0"></xsd:minLength>
                    <xsd:maxLength value="60"></xsd:maxLength>
                  </xsd:restriction>
                </xsd:simpleType>
              </xsd:element>
              <xsd:element name="NumeroTomador">
                <xsd:annotation>
                  <xsd:documentation>Número do Tomador de Serviço</xsd:documentation>
                </xsd:annotation>
                <xsd:simpleType>
                  <xsd:restriction base="xsd:string">
                    <xsd:minLength value="0"></xsd:minLength>
                    <xsd:maxLength value="10"></xsd:maxLength>
                  </xsd:restriction>
                </xsd:simpleType>
              </xsd:element>
              <xsd:element name="ComplementoTomador">
                <xsd:annotation>
                  <xsd:documentation>Complemento do Tomador de Serviço</xsd:documentation>
                </xsd:annotation>
                <xsd:simpleType>
                  <xsd:restriction base="xsd:string">
                    <xsd:minLength value="0"></xsd:minLength>
                    <xsd:maxLength value="60"></xsd:maxLength>
                  </xsd:restriction>
                </xsd:simpleType>
              </xsd:element>
              <xsd:element name="BairroTomador">
                <xsd:annotation>
                  <xsd:documentation>Bairro do Tomador de Serviço</xsd:documentation>
                </xsd:annotation>
                <xsd:simpleType>
                  <xsd:restriction base="xsd:string">
                    <xsd:minLength value="0"></xsd:minLength>
                    <xsd:maxLength value="40"></xsd:maxLength>
                  </xsd:restriction>
                </xsd:simpleType>
              </xsd:element>
              <xsd:element name="CEPTomador">
                <xsd:annotation>
                  <xsd:documentation>CEP do Tomador de Serviço</xsd:documentation>
                </xsd:annotation>
                <xsd:simpleType>
                  <xsd:restriction base="xsd:string">
                    <xsd:pattern value="[0-9]{5}-[0-9]{3}"></xsd:pattern>
                  </xsd:restriction>
                </xsd:simpleType>
              </xsd:element>
              <xsd:element name="EmailTomador">
                <xsd:annotation>
                  <xsd:documentation>E-mail do Tomador de Serviço</xsd:documentation>
                </xsd:annotation>
                <xsd:simpleType>
                  <xsd:restriction base="xsd:string">
                    <xsd:minLength value="0"></xsd:minLength>
                    <xsd:maxLength value="50"></xsd:maxLength>
                  </xsd:restriction>
                </xsd:simpleType>
              </xsd:element>
              <xsd:element name="Observacao">
                <xsd:annotation>
                  <xsd:documentation>Observações da Nota Fiscal</xsd:documentation>
                </xsd:annotation>
                <xsd:simpleType>
                  <xsd:restriction base="xsd:string">
                    <xsd:minLength value="0"></xsd:minLength>
                    <xsd:maxLength value="200"></xsd:maxLength>
                  </xsd:restriction>
                </xsd:simpleType>
              </xsd:element>
              <xsd:element name="NFSubstituta" type="xsd:decimal" fixed="0000000000">
                <xsd:annotation>
                  <xsd:documentation>Informar o número da Nota Fiscal Substituta de uma Nota Fiscal Cancelada.</xsd:documentation>
                </xsd:annotation>
              </xsd:element>
              <xsd:element name="LocalPrestacao">
                <xsd:annotation>
                  <xsd:documentation>
                    Local da Prestação do Serviço
                    1 - para serviço na sede do prestador
                    2 - para serviço para imóvel (Construção Civil)
                    3 - para serviço em via pública
                    4 - para serviço fora do município
                  </xsd:documentation>
                </xsd:annotation>
                <xsd:simpleType>
                  <xsd:restriction base="xsd:integer">
                    <xsd:enumeration value="1"></xsd:enumeration>
                    <xsd:enumeration value="2"></xsd:enumeration>
                    <xsd:enumeration value="3"></xsd:enumeration>
                    <xsd:enumeration value="4"></xsd:enumeration>
                  </xsd:restriction>
                </xsd:simpleType>
              </xsd:element>
              <xsd:element name="DescricaoLocalPrestacao">
                <xsd:annotation>
                  <xsd:documentation>Dados do Local de Prestação do Serviço</xsd:documentation>
                </xsd:annotation>
                <xsd:simpleType>
                  <xsd:restriction base="xsd:string">
                    <xsd:minLength value="0"></xsd:minLength>
                    <xsd:maxLength value="60"></xsd:maxLength>
                  </xsd:restriction>
                </xsd:simpleType>
              </xsd:element>
              <xsd:element name="DescricaoLocalPrestacaoComplementar">
                <xsd:annotation>
                  <xsd:documentation>Dados complementares do Local de Prestação do Serviço</xsd:documentation>
                </xsd:annotation>
                <xsd:simpleType>
                  <xsd:restriction base="xsd:string">
                    <xsd:minLength value="0"></xsd:minLength>
                    <xsd:maxLength value="50"></xsd:maxLength>
                  </xsd:restriction>
                </xsd:simpleType>
              </xsd:element>
              <xsd:element name="InscricaoImovel" type="xsd:decimal">
                <xsd:annotation>
                  <xsd:documentation>Inscrição Cadastral do Imóvel (usar quando o Local de Prestação for do tipo 2)</xsd:documentation>
                </xsd:annotation>
              </xsd:element>
              <xsd:element name="UFLocalPrestacao">
                <xsd:annotation>
                  <xsd:documentation>Sigla do Estado da Prestação do Serviço (usar quando o Local de Prestação for do tipo 4)</xsd:documentation>
                </xsd:annotation>
                <xsd:simpleType>
                  <xsd:restriction base="xsd:string">
                    <xsd:enumeration value=""></xsd:enumeration>
                    <xsd:enumeration value="AC"></xsd:enumeration>
                    <xsd:enumeration value="AL"></xsd:enumeration>
                    <xsd:enumeration value="AM"></xsd:enumeration>
                    <xsd:enumeration value="AP"></xsd:enumeration>
                    <xsd:enumeration value="BA"></xsd:enumeration>
                    <xsd:enumeration value="CE"></xsd:enumeration>
                    <xsd:enumeration value="DF"></xsd:enumeration>
                    <xsd:enumeration value="ES"></xsd:enumeration>
                    <xsd:enumeration value="GO"></xsd:enumeration>
                    <xsd:enumeration value="MA"></xsd:enumeration>
                    <xsd:enumeration value="MG"></xsd:enumeration>
                    <xsd:enumeration value="MS"></xsd:enumeration>
                    <xsd:enumeration value="MT"></xsd:enumeration>
                    <xsd:enumeration value="PA"></xsd:enumeration>
                    <xsd:enumeration value="PB"></xsd:enumeration>
                    <xsd:enumeration value="PE"></xsd:enumeration>
                    <xsd:enumeration value="PI"></xsd:enumeration>
                    <xsd:enumeration value="PR"></xsd:enumeration>
                    <xsd:enumeration value="RJ"></xsd:enumeration>
                    <xsd:enumeration value="RN"></xsd:enumeration>
                    <xsd:enumeration value="RO"></xsd:enumeration>
                    <xsd:enumeration value="RR"></xsd:enumeration>
                    <xsd:enumeration value="RS"></xsd:enumeration>
                    <xsd:enumeration value="SC"></xsd:enumeration>
                    <xsd:enumeration value="SE"></xsd:enumeration>
                    <xsd:enumeration value="SP"></xsd:enumeration>
                    <xsd:enumeration value="TO"></xsd:enumeration>
                  </xsd:restriction>
                </xsd:simpleType>
              </xsd:element>
              <xsd:element name="CidadeLocalPrestacao">
                <xsd:annotation>
                  <xsd:documentation>Cidade da Prestação do Serviço (usar quando o Local de Prestação for do tipo 4)</xsd:documentation>
                </xsd:annotation>
                <xsd:simpleType>
                  <xsd:restriction base="xsd:integer">
                    <xsd:pattern value="[0-9]{7}"></xsd:pattern>
                  </xsd:restriction>
                </xsd:simpleType>
              </xsd:element>
              <xsd:element name="EnderecoLocalPrestacao">
                <xsd:annotation>
                  <xsd:documentation>Endereço da Prestação do Serviço (usar quando o Local de Prestação for do tipo 3 ou 4)</xsd:documentation>
                </xsd:annotation>
                <xsd:simpleType>
                  <xsd:restriction base="xsd:string">
                    <xsd:minLength value="0"></xsd:minLength>
                    <xsd:maxLength value="60"></xsd:maxLength>
                  </xsd:restriction>
                </xsd:simpleType>
              </xsd:element>
              <xsd:element name="NumeroLocalPrestacao">
                <xsd:annotation>
                  <xsd:documentation>Número da localização do imóvel da Prestação do Serviço (usar quando o Local de Prestação for do tipo 4)</xsd:documentation>
                </xsd:annotation>
                <xsd:simpleType>
                  <xsd:restriction base="xsd:string">
                    <xsd:minLength value="0"></xsd:minLength>
                    <xsd:maxLength value="10"></xsd:maxLength>
                  </xsd:restriction>
                </xsd:simpleType>
              </xsd:element>
              <xsd:element name="ComplementoLocalPrestacao">
                <xsd:annotation>
                  <xsd:documentation>Complemento do imóvel da Prestação do Serviço (usar quando o Local de Prestação for do tipo 4)</xsd:documentation>
                </xsd:annotation>
                <xsd:simpleType>
                  <xsd:restriction base="xsd:string">
                    <xsd:minLength value="0"></xsd:minLength>
                    <xsd:maxLength value="30"></xsd:maxLength>
                  </xsd:restriction>
                </xsd:simpleType>
              </xsd:element>
              <xsd:element name="BairroLocalPrestacao">
                <xsd:annotation>
                  <xsd:documentation>Bairro da Prestação do Serviço (usar quando o Local de Prestação for do tipo 4)</xsd:documentation>
                </xsd:annotation>
                <xsd:simpleType>
                  <xsd:restriction base="xsd:string">
                    <xsd:minLength value="0"></xsd:minLength>
                    <xsd:maxLength value="40"></xsd:maxLength>
                  </xsd:restriction>
                </xsd:simpleType>
              </xsd:element>
              <xsd:element name="CEPLocalPrestacao">
                <xsd:annotation>
                  <xsd:documentation>CEP da Prestação do Serviço (usar quando o Local de Prestação for do tipo 4)</xsd:documentation>
                </xsd:annotation>
                <xsd:simpleType>
                  <xsd:restriction base="xsd:string">
                    <xsd:pattern value="[0-9]{5}-[0-9]{3}"></xsd:pattern>
                  </xsd:restriction>
                </xsd:simpleType>
              </xsd:element>
              <xsd:element name="MotivoCancelamento" type="xsd:string" fixed="">
                <xsd:annotation>
                  <xsd:documentation>Descrição do Motivo de Cancelamento da Nota Fiscal</xsd:documentation>
                </xsd:annotation>
              </xsd:element>
              <xsd:element name="TipoDocumento">
                <xsd:annotation>
                  <xsd:documentation>Código do Tipo de Nota Fiscal (verificar com a Prefeitura a lista de códigos válidos)</xsd:documentation>
                </xsd:annotation>
                <xsd:simpleType>
                  <xsd:restriction base="xsd:integer">
                    <xsd:pattern value="[0-9]{3}"></xsd:pattern>
                  </xsd:restriction>
                </xsd:simpleType>
              </xsd:element>
              <xsd:element name="DadosItensNotaFiscal" minOccurs="1" maxOccurs="1">
                <xsd:complexType>
                  <xsd:sequence>
                    <xsd:element name="ItemAtividade" type="xsd:integer">
                      <xsd:annotation>
                        <xsd:documentation>Código do Item da Atividade prestado (de acordo com lista informada pela Prefeitura)</xsd:documentation>
                      </xsd:annotation>
                    </xsd:element>
                    <xsd:element name="TextoItem">
                      <xsd:annotation>
                        <xsd:documentation>Texto do Item da Nota Fiscal</xsd:documentation>
                      </xsd:annotation>
                      <xsd:simpleType>
                        <xsd:restriction base="xsd:string">
                          <xsd:minLength value="10"></xsd:minLength>
                          <xsd:maxLength value="1000"></xsd:maxLength>
                        </xsd:restriction>
                      </xsd:simpleType>
                    </xsd:element>
                    <xsd:element name="ValorItem" type="xsd:decimal">
                      <xsd:annotation>
                        <xsd:documentation>Valor do Item da Nota Fiscal</xsd:documentation>
                      </xsd:annotation>
                    </xsd:element>
                    <xsd:element name="ValorDeducao" type="xsd:decimal">
                      <xsd:annotation>
                        <xsd:documentation>Valor das Deduções da Nota Fiscal</xsd:documentation>
                      </xsd:annotation>
                    </xsd:element>
                    <xsd:element name="Retido">
                      <xsd:annotation>
                        <xsd:documentation>
                          Identifica se o imposto do serviço foi retido na fonte pelo Tomador
                          S - para Imposto Retido pelo Tomador
                          N - para Imposto Não Retido pelo Tomador
                        </xsd:documentation>
                      </xsd:annotation>
                      <xsd:simpleType>
                        <xsd:restriction base="xsd:string">
                          <xsd:enumeration value="S"></xsd:enumeration>
                          <xsd:enumeration value="N"></xsd:enumeration>
                        </xsd:restriction>
                      </xsd:simpleType>
                    </xsd:element>
                    <xsd:element name="Pais">
                      <xsd:simpleType>
                        <xsd:restriction base="xsd:string">
                          <xsd:minLength value="0"></xsd:minLength>
                          <xsd:maxLength value="50"></xsd:maxLength>
                        </xsd:restriction>
                      </xsd:simpleType>
                    </xsd:element>
                  </xsd:sequence>
                </xsd:complexType>
              </xsd:element>
              <xsd:element name="DadosImpostosNotaFiscal" minOccurs="0" maxOccurs="5">
                <xsd:complexType>
                  <xsd:sequence>
                    <xsd:element name="Imposto">
                      <xsd:annotation>
                        <xsd:documentation>Sigla do Imposto utilizado na Dedução</xsd:documentation>
                      </xsd:annotation>
                      <xsd:simpleType>
                        <xsd:restriction base="xsd:string">
                          <xsd:minLength value="3"></xsd:minLength>
                          <xsd:maxLength value="6"></xsd:maxLength>
                        </xsd:restriction>
                      </xsd:simpleType>
                    </xsd:element>
                    <xsd:element name="ValorImposto" type="xsd:decimal">
                      <xsd:annotation>
                        <xsd:documentation>Valor do Imposto utilizado na Dedução</xsd:documentation>
                      </xsd:annotation>
                    </xsd:element>
                  </xsd:sequence>
                </xsd:complexType>
              </xsd:element>
            </xsd:sequence>
          </xsd:complexType>
        </xsd:element>
      </xsd:sequence>
    </xsd:complexType>
  </xsd:element>
</xsd:schema>