Я использую библиотеку XML в Python, и, поскольку я новичок в этом деле, не могу найти решение, даже если я проверил этот форум, есть похожие вопросы, но структура XML-документа не такая, как у меня.
Это мой XML:
Код: Выделить всё
IF149-0111/24
1
3.00
26574.00
5314.80
5314.800
20.0
S
20%
20.0
[P11190420] Toner Cartridge Brother DCP5500/MFC L 5700/6800 TN3410/3480 Katun Select
[P11190420] Toner Cartridge Brother DCP5500/MFC L 5700/6800 TN3410/3480 Katun Select
S
20%
20.0
2
1.00
600.00
120.00
120.000
20.0
S
20%
20.0
VAT
[U11124116] Usluga transporta
[U11124116] Usluga transporta
U11124116
S
20%
20.0
VAT
600.00
1.00
Код: Выделить всё
import xml.etree.ElementTree as ET
tree = ET.parse("test.xml")
root = tree.getroot()
for x in root.findall('.//'):
print(x.tag, " ", x.get('InvoiceLine'))
Код: Выделить всё
{urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2}CustomizationID None
{urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2}ID None
{urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2}IssueDate None
{urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2}DueDate None
- InvoicedQuantity
- LineExtensionAmount
- TaxAmount
- Процент
- ID
< li>Описание - Имя
- cbc:ID
...etc
Подробнее здесь: https://stackoverflow.com/questions/790 ... -in-python