mirror of
https://github.com/Ircama/epson_print_conf.git
synced 2025-05-13 22:54:40 -04:00
Refinements
This commit is contained in:
parent
fcd0c41076
commit
64d7a915c2
1 changed files with 9 additions and 6 deletions
|
@ -27,12 +27,15 @@ def text_to_dict(text):
|
|||
|
||||
def traverse_data(element, depth=0):
|
||||
indent = ' ' * depth
|
||||
if element.tag:
|
||||
print(indent + element.tag)
|
||||
if element.attrib:
|
||||
print(indent + ' Attributes:', element.attrib)
|
||||
if element.text and element.text.strip():
|
||||
print(indent + ' Text:', element.text.strip())
|
||||
if element.tag and not element.attrib and element.text and element.text.strip():
|
||||
print(indent + element.tag + " = " + element.text)
|
||||
else:
|
||||
if element.tag:
|
||||
print(indent + element.tag + ":")
|
||||
if element.attrib:
|
||||
print(indent + ' Attributes:', element.attrib)
|
||||
if element.text and element.text.strip():
|
||||
print(indent + ' Text:', element.text.strip())
|
||||
|
||||
# Recursively traverse the children
|
||||
for child in element:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue