Browse Source

[IMP] Layouts de validação da NFe

pull/155/head
Danimar Ribeiro 7 years ago
parent
commit
0ede46a705
  1. 18
      pytrustnfe/xml/schemas/enviNFe_v4.00.xsd
  2. 12540
      pytrustnfe/xml/schemas/leiauteNFe_v4.00.xsd
  3. 18
      pytrustnfe/xml/schemas/nfe_v4.00.xsd
  4. 1160
      pytrustnfe/xml/schemas/tiposBasico_v4.00.xsd
  5. 0
      pytrustnfe/xml/schemas/xmldsig-core-schema_v1.01.xsd
  6. 4
      pytrustnfe/xml/validate.py

18
pytrustnfe/xml/schemas/enviNFe_v3.10.xsd → pytrustnfe/xml/schemas/enviNFe_v4.00.xsd

@ -1,9 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="http://www.portalfiscal.inf.br/nfe" xmlns:ds="http://www.w3.org/2000/09/xmldsig#" targetNamespace="http://www.portalfiscal.inf.br/nfe" elementFormDefault="qualified" attributeFormDefault="unqualified">
<xs:include schemaLocation="leiauteNFe_v3.10.xsd"/>
<xs:element name="enviNFe" type="TEnviNFe">
<xs:annotation>
<xs:documentation>Schema XML de validação do Pedido de Concessão de Autorização da Nota Fiscal Eletrônica</xs:documentation>
</xs:annotation>
</xs:element>
</xs:schema>
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="http://www.portalfiscal.inf.br/nfe" xmlns:ds="http://www.w3.org/2000/09/xmldsig#" targetNamespace="http://www.portalfiscal.inf.br/nfe" elementFormDefault="qualified" attributeFormDefault="unqualified">
<xs:include schemaLocation="leiauteNFe_v4.00.xsd"/>
<xs:element name="enviNFe" type="TEnviNFe">
<xs:annotation>
<xs:documentation>Schema XML de validação do Pedido de Concessão de Autorização da Nota Fiscal Eletrônica</xs:documentation>
</xs:annotation>
</xs:element>
</xs:schema>

12540
pytrustnfe/xml/schemas/leiauteNFe_v4.00.xsd
File diff suppressed because it is too large
View File

18
pytrustnfe/xml/schemas/nfe_v3.10.xsd → pytrustnfe/xml/schemas/nfe_v4.00.xsd

@ -1,9 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:ds="http://www.w3.org/2000/09/xmldsig#" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="http://www.portalfiscal.inf.br/nfe" targetNamespace="http://www.portalfiscal.inf.br/nfe" elementFormDefault="qualified" attributeFormDefault="unqualified">
<xs:include schemaLocation="leiauteNFe_v3.10.xsd"/>
<xs:element name="NFe" type="TNFe">
<xs:annotation>
<xs:documentation>Nota Fiscal Eletrônica</xs:documentation>
</xs:annotation>
</xs:element>
</xs:schema>
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:ds="http://www.w3.org/2000/09/xmldsig#" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="http://www.portalfiscal.inf.br/nfe" targetNamespace="http://www.portalfiscal.inf.br/nfe" elementFormDefault="qualified" attributeFormDefault="unqualified">
<xs:include schemaLocation="leiauteNFe_v4.00.xsd"/>
<xs:element name="NFe" type="TNFe">
<xs:annotation>
<xs:documentation>Nota Fiscal Eletrônica</xs:documentation>
</xs:annotation>
</xs:element>
</xs:schema>

1160
pytrustnfe/xml/schemas/tiposBasico_v4.00.xsd
File diff suppressed because it is too large
View File

0
pytrustnfe/xml/schemas/xmldsig-core-schema_v1.01.xsd

4
pytrustnfe/xml/validate.py

@ -8,7 +8,7 @@ import re
from lxml import etree
PATH = os.path.dirname(os.path.abspath(__file__))
SCHEMA = os.path.join(PATH, 'schemas/nfe_v3.10.xsd')
SCHEMA = os.path.join(PATH, 'schemas/nfe_v4.00.xsd')
def pop_encoding(xml):
@ -30,7 +30,7 @@ def valida_nfe(nfe):
mensagens = []
for erro in erros:
campo = re.findall(r"'([^']*)'", erro)[0]
nome = campo[campo.find('}') + 1: ]
nome = campo[campo.find('}') + 1:]
valor = nfe.find('.//' + campo).text
if 'Expected is' in erro:
expected_name = re.findall('\(.*?\)', erro)

Loading…
Cancel
Save