File tree Expand file tree Collapse file tree 1 file changed +27
-0
lines changed Expand file tree Collapse file tree 1 file changed +27
-0
lines changed Original file line number Diff line number Diff line change 3
3
"""
4
4
5
5
from pathlib import Path
6
+ from typing import List
6
7
7
8
import tomlkit
8
9
from efoli import EdifactFormatVersion
@@ -77,3 +78,29 @@ def scrape_xml_pruefis(
77
78
input_path = input_path / Path ("UTILMD_AHB_Strom_2_1_2024_10_01_2024_09_20.xml" )
78
79
for pruefi in pruefis :
79
80
process_pruefi (pruefi , input_path , output_path , file_type )
81
+
82
+
83
+ def get_pruefidentifikator_list (xml_file_path : Path ) -> List [str ]:
84
+ """
85
+ Reads an XML file and returns a list of all Pruefidentifikator values found in it.
86
+
87
+ Args:
88
+ xml_file_path: Path to the XML file to read
89
+
90
+ Returns:
91
+ List of Pruefidentifikator values found in the file
92
+
93
+ Raises:
94
+ FileNotFoundError: If the XML file does not exist
95
+ Exception: If there is an error reading or parsing the XML file
96
+ """
97
+ if not xml_file_path .exists ():
98
+ raise FileNotFoundError (f"XML file not found: { xml_file_path } " )
99
+
100
+ reader = AhbReader (xml_file_path )
101
+ ahb = reader .read ()
102
+
103
+ if not isinstance (ahb , Anwendungshandbuch ):
104
+ raise Exception (f"Expected Anwendungshandbuch instance, got { type (ahb )} " )
105
+
106
+ return sorted (list ({awf .pruefidentifikator for awf in ahb .anwendungsfaelle }))
You can’t perform that action at this time.
0 commit comments