22 lines
662 B
Python
22 lines
662 B
Python
![]() |
# -*- 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))
|