Bug on choice element in xmlclass fixed
authorjon
Tue, 04 Sep 2007 17:08:12 +0200
changeset 84 0369ad49e67f
parent 83 180e4a0160b2
child 85 fd17b0e0fd7e
Bug on choice element in xmlclass fixed
xmlclass/xmlclass.py
--- a/xmlclass/xmlclass.py	Fri Aug 31 15:09:05 2007 +0200
+++ b/xmlclass/xmlclass.py	Tue Sep 04 17:08:12 2007 +0200
@@ -220,12 +220,12 @@
                 elif name == "choice":
                     super, attrs = self.GenerateXSDClasses(node, parent)
                     
-                    if "ref" in attrs.keys():
-                        choices = attrs
-                    else:
-                        choices = {}
-                        for attr, (attr_type, xml_type, write_type, default) in attrs.items():
-                            choices[attr] = attr_type
+                    choices = {}
+                    for attr, values in attrs.items():
+                        if attr == "ref":
+                            choices[attr] = values
+                        else:
+                            choices[attr] = values[0]
                     if "maxOccurs" in node._attrs and GetAttributeValue(node._attrs["maxOccurs"]) == "unbounded":
                         attributes["multichoice_content"] = choices
                         if sequence: