6
6
from collections .abc import Callable , Sequence
7
7
from random import SystemRandom
8
8
from typing import Any , Union
9
+ from xml .parsers .expat import ExpatError
9
10
10
11
from defusedxml .minidom import parseString
11
- from xml .parsers .expat import ExpatError
12
12
13
13
# Create a safe random number generator
14
14
@@ -191,7 +191,7 @@ def default_item_func(parent: str) -> str:
191
191
def _build_namespace_string (xml_namespaces : dict [str , Any ]) -> str :
192
192
"""Build XML namespace string from namespace dictionary."""
193
193
parts = []
194
-
194
+
195
195
for prefix , value in xml_namespaces .items ():
196
196
if prefix == 'xsi' and isinstance (value , dict ):
197
197
for schema_att , ns in value .items ():
@@ -203,7 +203,7 @@ def _build_namespace_string(xml_namespaces: dict[str, Any]) -> str:
203
203
parts .append (f'xmlns="{ value } "' )
204
204
else :
205
205
parts .append (f'xmlns:{ prefix } ="{ value } "' )
206
-
206
+
207
207
return ' ' + ' ' .join (parts ) if parts else ''
208
208
209
209
@@ -701,7 +701,7 @@ def dicttoxml(
701
701
"""
702
702
if xml_namespaces is None :
703
703
xml_namespaces = {}
704
-
704
+
705
705
output = []
706
706
namespace_str = _build_namespace_string (xml_namespaces )
707
707
if root :
0 commit comments