mirror of
https://github.com/karl0ss/comfy_fm24_newgens.git
synced 2025-04-29 04:13:40 +01:00
25 lines
622 B
Python
25 lines
622 B
Python
import xml.etree.ElementTree as ET
|
|
|
|
def extract_from_values(xml_file):
|
|
"""
|
|
Extract all 'from' values from the record elements in the XML file.
|
|
|
|
Args:
|
|
xml_file (str): Path to the XML file.
|
|
|
|
Returns:
|
|
list: List of all 'from' attribute values.
|
|
"""
|
|
from_values = []
|
|
|
|
# Parse the XML file
|
|
tree = ET.parse(xml_file)
|
|
root = tree.getroot()
|
|
|
|
# Find all 'record' elements and extract 'from' attributes
|
|
for record in root.findall(".//record"):
|
|
from_value = record.get('from')
|
|
if from_value:
|
|
from_values.append(from_value)
|
|
|
|
return from_values |