@@ -209,7 +209,6 @@ def set_text(self, value, base64encode=False):
209
209
}
210
210
211
211
_type_from_xs_type = {
212
- 'xs:anyType' : str ,
213
212
'xs:string' : str ,
214
213
'xs:integer' : int ,
215
214
'xs:short' : int ,
@@ -219,11 +218,11 @@ def set_text(self, value, base64encode=False):
219
218
'xs:double' : float ,
220
219
'xs:boolean' : bool ,
221
220
'xs:base64Binary' : str ,
221
+ 'xs:anyType' : type (value ),
222
222
'' : type (None ),
223
223
}
224
224
225
225
_typed_value_constructor_from_xs_type = {
226
- 'xs:anyType' : str ,
227
226
'xs:string' : str ,
228
227
'xs:integer' : int ,
229
228
'xs:short' : int ,
@@ -236,11 +235,11 @@ def set_text(self, value, base64encode=False):
236
235
else False if str (x ).lower () == 'false'
237
236
else None ,
238
237
'xs:base64Binary' : str ,
238
+ 'xs:anyType' : lambda x : value ,
239
239
'' : lambda x : None ,
240
240
}
241
241
242
242
_text_constructor_from_xs_type = {
243
- 'xs:anyType' : str ,
244
243
'xs:string' : str ,
245
244
'xs:integer' : str ,
246
245
'xs:short' : str ,
@@ -253,6 +252,7 @@ def set_text(self, value, base64encode=False):
253
252
_b64_encode_fn (x .encode ())
254
253
if base64encode
255
254
else x ,
255
+ 'xs:anyType' : lambda x : value ,
256
256
'' : lambda x : '' ,
257
257
}
258
258
@@ -263,12 +263,7 @@ def set_text(self, value, base64encode=False):
263
263
'xs:base64Binary' \
264
264
if base64encode \
265
265
else self .get_type () \
266
- or _xs_type_from_type .get (type (value ))
267
-
268
- if xs_type is None :
269
- msg_tpl = 'No corresponding xs-type for {type}:{value}'
270
- msg = msg_tpl .format (type = type (value ), value = value )
271
- raise ValueError (msg )
266
+ or _xs_type_from_type .get (type (value ), type (None ))
272
267
273
268
valid_type = _type_from_xs_type .get (xs_type , type (None ))
274
269
to_typed = _typed_value_constructor_from_xs_type .get (xs_type , str )
0 commit comments