export: add factur-x 1.07.2

This commit is contained in:
Frederik Jaeckel 2024-12-05 15:36:07 +01:00
parent 3d703e300e
commit 764cacc091
5 changed files with 259 additions and 10 deletions

21
tests/validate_xml.py Normal file
View file

@ -0,0 +1,21 @@
# -*- coding: utf-8 -*-
# This file is part of the edocument-module for Tryton from m-ds.de.
# The COPYRIGHT file at the top level of this repository contains the
# full copyright notices and license terms.
from lxml import etree
import os
file_name = 'file-to-check.xml'
schema_file = os.path.join(
os.path.dirname(__file__),
'Factur-X_1.07.2_EXTENDED',
'Factur-X_1.07.2_EXTENDED.xsd')
with open(file_name, 'r') as fhdl:
f_content = fhdl.read()
f_content = f_content.encode('utf8')
invoice_xml = etree.fromstring(f_content)
schema = etree.XMLSchema(etree.parse(schema_file))
print('Result:', schema.assertValid(invoice_xml))