--- a/xmlclass/xmlclass.py Fri Aug 10 15:58:40 2018 +0300
+++ b/xmlclass/xmlclass.py Fri Aug 10 17:45:33 2018 +0300
@@ -1162,6 +1162,7 @@
classmembers["get%s" % elmtname] = generateGetMethod(elmtname)
classmembers["_init_"] = generateInitMethod(self, classinfos)
+ classmembers["_tmp_initial_"] = None
classmembers["StructurePattern"] = GetStructurePattern(classinfos)
classmembers["getElementAttributes"] = generateGetElementAttributes(self, classinfos)
classmembers["getElementInfos"] = generateGetElementInfos(self, classinfos)
@@ -1581,6 +1582,10 @@
if element["type"] != CHOICE:
initial = GetElementInitialValue(factory, element)
if initial is not None:
+ # FIXME: this is looks like dirty hack to fix strange problem with initial[0]
+ # changing its type after returning from _init_ method to lxml.etree._Element
+ # As a result all methods generated by class factory are lost.
+ object.__setattr__(self, "_tmp_initial_", initial)
map(self.append, initial)
return initMethod