--- a/xmlclass/xmlclass.py Mon Sep 10 16:12:29 2007 +0200
+++ b/xmlclass/xmlclass.py Mon Sep 10 18:16:07 2007 +0200
@@ -42,6 +42,12 @@
date_model = re.compile('([0-9]{4})-([0-9]{2})-([0-9]{2})')
datetime_model = re.compile('([0-9]{4})-([0-9]{2})-([0-9]{2})[ T]([0-9]{2}):([0-9]{2}):([0-9]{2}(?:.[0-9]*)?)')
+XSD_INTEGER_TYPES = ["integer","nonPositiveInteger","negativeInteger","long",
+ "int","short","byte","nonNegativeInteger","unsignedLong","unsignedInt",
+ "unsignedShort","unsignedByte","positiveInteger"]
+
+XSD_STRING_TYPES = ["string","normalizedString","token","anyURI","NMTOKEN","language"]
+
"""
This function calculates the number of whitespace for indentation
"""
@@ -88,14 +94,14 @@
return False
else:
raise ValueError, "\"%s\" is not a valid boolean!"%value
- elif type_compute in ["unsignedLong","long","integer"]:
+ elif type_compute in XSD_INTEGER_TYPES:
return int(value)
- elif type_compute == "decimal":
+ elif type_compute in ["decimal", "float", "double"]:
computed_value = float(value)
if computed_value % 1 == 0:
return int(computed_value)
return computed_value
- elif type_compute in ["string","anyURI","NMTOKEN","language"]:
+ elif type_compute in XSD_STRING_TYPES:
return value
elif type_compute == "time":
result = time_model.match(value)