Commit 1b05d1d6 authored by Dave Kuhlman's avatar Dave Kuhlman

v. 2.29.23 Automatically create mandatory children

parent b0c56c9f
......@@ -141,6 +141,16 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Change history
--------------
Version 2.29.23 (08/16/2018)
- Added new command line option "--create-mandatory-children". If a
child is defined with minOccurs="1" and maxOccurs="1" and the
child is xs:complexType and the child is not defined with
xs:simpleContent, then in the element's constructor generate code
that automatically creates an instance of the child. Thanks to
Vincent Helfre for analyzing this issue and providing guidance
toward a solution.
Version 2.29.22 (08/03/2018)
- Fixed exception that occurs when (1) an xs:complexType is defined
......
......@@ -220,7 +220,7 @@ They are used by updateversion.py. -->
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">revision:</th><td class="field-body">2.29.22</td>
<tr class="field"><th class="field-name">revision:</th><td class="field-body">2.29.23</td>
</tr>
</tbody>
</table>
......@@ -229,7 +229,7 @@ They are used by updateversion.py. -->
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">date:</th><td class="field-body">August 03, 2018</td>
<tr class="field"><th class="field-name">date:</th><td class="field-body">August 16, 2018</td>
</tr>
</tbody>
</table>
......@@ -661,6 +661,14 @@ Options:
Default: &quot;[('[-:.]', '_')]&quot;
--mixed-case-enums If used, do not uppercase simpleType enums names.
Default is to make enum names uppercase.
--create-mandatory-children
If a child is defined with minOccurs=&quot;1&quot; and
maxOccurs=&quot;1&quot; and the child is xs:complexType
and the child is not defined with
xs:simpleContent, then in the element's
constructor generate code that automatically
creates an instance of the child. The default
is False, i.e. do not automatically create child.
-q, --no-questions Do not ask questions, for example,
force overwrite.
--no-warnings Do not print warning messages.
......@@ -979,6 +987,15 @@ characters. Example:
<dd>Do not uppercase the names of simpleType enums. The default (if
this option is omitted) is to make generated enum names
uppercase.</dd>
<dt>create-mandatory-children</dt>
<dd>If a child is defined with minOccurs=&quot;1&quot; and maxOccurs=&quot;1&quot; and
the child is xs:complexType and the child is not defined with
xs:simpleContent, then in the element's constructor generate
code that automatically creates an instance of the child. The
default is False, i.e. do not automatically create the child.
Note that if a value for the child's parameter is passed to the
constructor (which overrides the default value of None), then
the constructor will not create an instance.</dd>
<dt>q, no-questions</dt>
<dd>Do not ask questions. For example, if the &quot;-f&quot; command line
option is omitted and the ouput file exists, then generateDS.py
......@@ -3392,7 +3409,7 @@ following among others:</p>
<div class="footer">
<hr class="footer" />
<a class="reference external" href="generateDS.txt">View document source</a>.
Generated on: 2018-08-03 21:41 UTC.
Generated on: 2018-08-16 22:29 UTC.
Generated by <a class="reference external" href="http://docutils.sourceforge.net/">Docutils</a> from <a class="reference external" href="http://docutils.sourceforge.net/rst.html">reStructuredText</a> source.
</div>
......
......@@ -126,6 +126,14 @@ Options:
Default: "[('[-:.]', '_')]"
--mixed-case-enums If used, do not uppercase simpleType enums names.
Default is to make enum names uppercase.
--create-mandatory-children
If a child is defined with minOccurs="1" and
maxOccurs="1" and the child is xs:complexType
and the child is not defined with
xs:simpleContent, then in the element's
constructor generate code that automatically
creates an instance of the child. The default
is False, i.e. do not automatically create child.
-q, --no-questions Do not ask questions, for example,
force overwrite.
--no-warnings Do not print warning messages.
......@@ -227,7 +235,7 @@ _log = logging.getLogger(__name__)
# Do not modify the following VERSION comments.
# Used by updateversion.py.
##VERSION##
VERSION = '2.29.22'
VERSION = '2.29.23'
##VERSION##
BaseStrTypes = six.string_types
......@@ -253,6 +261,7 @@ NoQuestions = False
NoDates = False
NoVersion = False
AlwaysExportDefault = False
CreateMandatoryChildren = False
Dirpath = []
ExternalEncoding = ''
Namespacedef = ''
......@@ -3707,7 +3716,8 @@ def generateBuildStandard_1(
childType == NonPositiveIntegerType or
childType == NegativeIntegerType or
childType == NonNegativeIntegerType):
wrt(" %s nodeName_ == '%s':\n" % (keyword, origName, ))
wrt(" %s nodeName_ == '%s' and child_.text:\n" % (
keyword, origName, ))
wrt(" sval_ = child_.text\n")
wrt(" try:\n")
wrt(" ival_ = int(sval_)\n")
......@@ -3756,7 +3766,8 @@ def generateBuildStandard_1(
elif (childType == FloatType or
childType == DoubleType or
childType == DecimalType):
wrt(" %s nodeName_ == '%s':\n" % (keyword, origName, ))
wrt(" %s nodeName_ == '%s' and child_.text:\n" % (
keyword, origName, ))
wrt(" sval_ = child_.text\n")
wrt(" try:\n")
wrt(" fval_ = float(sval_)\n")
......@@ -4239,6 +4250,11 @@ def generateCtor(wrt, prefix, element):
_log.debug("Constructor child: %s" % name)
_log.debug("Dump: %s" % child.__dict__)
childType = child.getType()
childTypeDef = ElementDict.get(childType)
if childTypeDef is not None:
childSimpleContent = childTypeDef.getSimpleContent()
else:
childSimpleContent = False
if childType == AnyTypeIdentifier:
if child.getMaxOccurs() > 1:
wrt(' if anytypeobjs_ is None:\n')
......@@ -4283,6 +4299,18 @@ def generateCtor(wrt, prefix, element):
wrt(' self.%s = []\n' % (name, ))
wrt(' else:\n')
wrt(' self.%s = %s\n' % (name, mbrname))
elif (CreateMandatoryChildren and
child.getMinOccurs() == 1 and
child.getMaxOccurs() == 1 and
child.isComplex() and
not childSimpleContent):
wrt(' if %s is None:\n' % (mbrname, ))
className = child.getType()
className = cleanupName(className)
wrt(' self.%s = globals()["%s"]()\n' % (
name, className, ))
wrt(' else:\n')
wrt(' self.%s = %s\n' % (name, mbrname))
else:
typeObj = ElementDict.get(child.getType())
if (child.getDefault() and
......@@ -7266,7 +7294,7 @@ def main():
UseGeneratedssuperLookup, UseSourceFileAsModuleName, \
PreserveCdataTags, CleanupNameList, \
NoWarnings, AlwaysExportDefault, \
UppercaseEnums
UppercaseEnums, CreateMandatoryChildren
outputText = True
args = sys.argv[1:]
try:
......@@ -7289,6 +7317,7 @@ def main():
'no-warnings',
'no-collect-includes', 'no-redefine-groups',
'always-export-default', 'mixed-case-enums',
'create-mandatory-children',
])
except getopt.GetoptError:
usage()
......@@ -7312,6 +7341,7 @@ def main():
noCollectIncludes = False
noRedefineGroups = False
UppercaseEnums = True
CreateMandatoryChildren = False
for option in options:
if option[0] == '--session':
sessionFilename = option[1]
......@@ -7496,6 +7526,8 @@ def main():
AlwaysExportDefault = True
elif option[0] == '--mixed-case-enums':
UppercaseEnums = False
elif option[0] == '--create-mandatory-children':
CreateMandatoryChildren = True
if showVersion:
print('generateDS.py version %s' % VERSION)
sys.exit(0)
......
......@@ -12,7 +12,7 @@ generateDS -- Generate Data Structures from XML Schema
.. version
:revision: 2.29.22
:revision: 2.29.23
.. version
......@@ -348,6 +348,14 @@ Here is the usage message displayed by ``generateDS.py``::
Default: "[('[-:.]', '_')]"
--mixed-case-enums If used, do not uppercase simpleType enums names.
Default is to make enum names uppercase.
--create-mandatory-children
If a child is defined with minOccurs="1" and
maxOccurs="1" and the child is xs:complexType
and the child is not defined with
xs:simpleContent, then in the element's
constructor generate code that automatically
creates an instance of the child. The default
is False, i.e. do not automatically create child.
-q, --no-questions Do not ask questions, for example,
force overwrite.
--no-warnings Do not print warning messages.
......@@ -701,6 +709,16 @@ mixed-case-enums
this option is omitted) is to make generated enum names
uppercase.
create-mandatory-children
If a child is defined with minOccurs="1" and maxOccurs="1" and
the child is xs:complexType and the child is not defined with
xs:simpleContent, then in the element's constructor generate
code that automatically creates an instance of the child. The
default is False, i.e. do not automatically create the child.
Note that if a value for the child's parameter is passed to the
constructor (which overrides the default value of None), then
the constructor will not create an instance.
q, no-questions
Do not ask questions. For example, if the "-f" command line
option is omitted and the ouput file exists, then generateDS.py
......
......@@ -220,7 +220,7 @@ They are used by updateversion.py. -->
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">revision:</th><td class="field-body">2.29.22</td>
<tr class="field"><th class="field-name">revision:</th><td class="field-body">2.29.23</td>
</tr>
</tbody>
</table>
......@@ -229,7 +229,7 @@ They are used by updateversion.py. -->
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">date:</th><td class="field-body">August 03, 2018</td>
<tr class="field"><th class="field-name">date:</th><td class="field-body">August 16, 2018</td>
</tr>
</tbody>
</table>
......@@ -401,7 +401,7 @@ $ mv generateds_gui.mo locale/ru/LC_MESSAGES/
<div class="footer">
<hr class="footer" />
<a class="reference external" href="generateds_gui_notes.txt">View document source</a>.
Generated on: 2018-08-03 21:41 UTC.
Generated on: 2018-08-16 22:29 UTC.
Generated by <a class="reference external" href="http://docutils.sourceforge.net/">Docutils</a> from <a class="reference external" href="http://docutils.sourceforge.net/rst.html">reStructuredText</a> source.
</div>
......
......@@ -12,7 +12,7 @@ GenerateDS GUI Notes
.. version
:revision: 2.29.22
:revision: 2.29.23
.. version
......
......@@ -41,7 +41,7 @@ from libgenerateDS.gui import generateds_gui_session
# Do not modify the following VERSION comments.
# Used by updateversion.py.
##VERSION##
VERSION = '2.29.22'
VERSION = '2.29.23'
##VERSION##
......
......@@ -217,7 +217,7 @@ dkuhlman (at) davekuhlman (dot) org
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">revision:</th><td class="field-body">2.29.22</td>
<tr class="field"><th class="field-name">revision:</th><td class="field-body">2.29.23</td>
</tr>
</tbody>
</table>
......@@ -226,7 +226,7 @@ dkuhlman (at) davekuhlman (dot) org
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">date:</th><td class="field-body">August 03, 2018</td>
<tr class="field"><th class="field-name">date:</th><td class="field-body">August 16, 2018</td>
</tr>
</tbody>
</table>
......@@ -380,7 +380,7 @@ this command for your needs. For example, you may need to use
<div class="footer">
<hr class="footer" />
<a class="reference external" href="librarytemplate_howto.txt">View document source</a>.
Generated on: 2018-08-03 21:41 UTC.
Generated on: 2018-08-16 22:29 UTC.
Generated by <a class="reference external" href="http://docutils.sourceforge.net/">Docutils</a> from <a class="reference external" href="http://docutils.sourceforge.net/rst.html">reStructuredText</a> source.
</div>
......
......@@ -8,7 +8,7 @@ How to package a generateDS.py generated library
.. version
:revision: 2.29.22
:revision: 2.29.23
.. version
......
......@@ -40,7 +40,7 @@ except ImportError:
# Do not modify the following VERSION comments.
# Used by updateversion.py.
##VERSION##
VERSION = '2.29.22'
VERSION = '2.29.23'
##VERSION##
CatalogDict = {}
......
......@@ -8,7 +8,7 @@ setup(
# Do not modify the following VERSION comments.
# Used by updateversion.py.
##VERSION##
version="2.29.22",
version="2.29.23",
##VERSION##
author="Dave Kuhlman",
author_email="dkuhlman@davekuhlman.org",
......
......@@ -912,7 +912,7 @@ class document2Type(GeneratedsSuper):
comments_ = child_.text
comments_ = self.gds_validate_string(comments_, node, 'comments')
self.comments = comments_
elif nodeName_ == 'rating':
elif nodeName_ == 'rating' and child_.text:
sval_ = child_.text
try:
ival_ = int(sval_)
......@@ -1011,7 +1011,7 @@ class document3Type(GeneratedsSuper):
comments_ = child_.text
comments_ = self.gds_validate_string(comments_, node, 'comments')
self.comments = comments_
elif nodeName_ == 'rating':
elif nodeName_ == 'rating' and child_.text:
sval_ = child_.text
try:
ival_ = int(sval_)
......
......@@ -1106,7 +1106,7 @@ class CatalogType(GeneratedsSuper):
name_ = child_.text
name_ = self.gds_validate_string(name_, node, 'name')
self.name = name_
elif nodeName_ == 'catagory':
elif nodeName_ == 'catagory' and child_.text:
sval_ = child_.text
try:
ival_ = int(sval_)
......
......@@ -990,7 +990,7 @@ class DefaultType1(GeneratedsSuper):
def buildAttributes(self, node, attrs, already_processed):
pass
def buildChildren(self, child_, node, nodeName_, fromsubclass_=False):
if nodeName_ == 'normal01':
if nodeName_ == 'normal01' and child_.text:
sval_ = child_.text
try:
ival_ = int(sval_)
......@@ -1002,7 +1002,7 @@ class DefaultType1(GeneratedsSuper):
normal02_ = child_.text
normal02_ = self.gds_validate_string(normal02_, node, 'normal02')
self.normal02 = normal02_
elif nodeName_ == 'default01':
elif nodeName_ == 'default01' and child_.text:
sval_ = child_.text
try:
ival_ = int(sval_)
......@@ -1014,7 +1014,7 @@ class DefaultType1(GeneratedsSuper):
default02_ = child_.text
default02_ = self.gds_validate_string(default02_, node, 'default02')
self.default02 = default02_
elif nodeName_ == 'normal03':
elif nodeName_ == 'normal03' and child_.text:
sval_ = child_.text
try:
fval_ = float(sval_)
......@@ -1022,7 +1022,7 @@ class DefaultType1(GeneratedsSuper):
raise_parse_error(child_, 'requires float or double: %s' % exp)
fval_ = self.gds_validate_float(fval_, node, 'normal03')
self.normal03 = fval_
elif nodeName_ == 'normal04':
elif nodeName_ == 'normal04' and child_.text:
sval_ = child_.text
try:
fval_ = float(sval_)
......@@ -1030,7 +1030,7 @@ class DefaultType1(GeneratedsSuper):
raise_parse_error(child_, 'requires float or double: %s' % exp)
fval_ = self.gds_validate_float(fval_, node, 'normal04')
self.normal04 = fval_
elif nodeName_ == 'default03':
elif nodeName_ == 'default03' and child_.text:
sval_ = child_.text
try:
fval_ = float(sval_)
......@@ -1038,7 +1038,7 @@ class DefaultType1(GeneratedsSuper):
raise_parse_error(child_, 'requires float or double: %s' % exp)
fval_ = self.gds_validate_float(fval_, node, 'default03')
self.default03 = fval_
elif nodeName_ == 'default04':
elif nodeName_ == 'default04' and child_.text:
sval_ = child_.text
try:
fval_ = float(sval_)
......@@ -1286,7 +1286,7 @@ class FixedType1(GeneratedsSuper):
def buildAttributes(self, node, attrs, already_processed):
pass
def buildChildren(self, child_, node, nodeName_, fromsubclass_=False):
if nodeName_ == 'normal01':
if nodeName_ == 'normal01' and child_.text:
sval_ = child_.text
try:
ival_ = int(sval_)
......@@ -1298,7 +1298,7 @@ class FixedType1(GeneratedsSuper):
normal02_ = child_.text
normal02_ = self.gds_validate_string(normal02_, node, 'normal02')
self.normal02 = normal02_
elif nodeName_ == 'fixed01':
elif nodeName_ == 'fixed01' and child_.text:
sval_ = child_.text
try:
ival_ = int(sval_)
......@@ -1310,7 +1310,7 @@ class FixedType1(GeneratedsSuper):
fixed02_ = child_.text
fixed02_ = self.gds_validate_string(fixed02_, node, 'fixed02')
self.fixed02 = fixed02_
elif nodeName_ == 'normal03':
elif nodeName_ == 'normal03' and child_.text:
sval_ = child_.text
try:
fval_ = float(sval_)
......@@ -1318,7 +1318,7 @@ class FixedType1(GeneratedsSuper):
raise_parse_error(child_, 'requires float or double: %s' % exp)
fval_ = self.gds_validate_float(fval_, node, 'normal03')
self.normal03 = fval_
elif nodeName_ == 'normal04':
elif nodeName_ == 'normal04' and child_.text:
sval_ = child_.text
try:
fval_ = float(sval_)
......@@ -1326,7 +1326,7 @@ class FixedType1(GeneratedsSuper):
raise_parse_error(child_, 'requires float or double: %s' % exp)
fval_ = self.gds_validate_float(fval_, node, 'normal04')
self.normal04 = fval_
elif nodeName_ == 'fixed03':
elif nodeName_ == 'fixed03' and child_.text:
sval_ = child_.text
try:
fval_ = float(sval_)
......@@ -1334,7 +1334,7 @@ class FixedType1(GeneratedsSuper):
raise_parse_error(child_, 'requires float or double: %s' % exp)
fval_ = self.gds_validate_float(fval_, node, 'fixed03')
self.fixed03 = fval_
elif nodeName_ == 'fixed04':
elif nodeName_ == 'fixed04' and child_.text:
sval_ = child_.text
try:
fval_ = float(sval_)
......
......@@ -955,7 +955,7 @@ class DefaultType1(GeneratedsSuper):
def buildAttributes(self, node, attrs, already_processed):
pass
def buildChildren(self, child_, node, nodeName_, fromsubclass_=False):
if nodeName_ == 'normal01':
if nodeName_ == 'normal01' and child_.text:
sval_ = child_.text
try:
ival_ = int(sval_)
......@@ -967,7 +967,7 @@ class DefaultType1(GeneratedsSuper):
normal02_ = child_.text
normal02_ = self.gds_validate_string(normal02_, node, 'normal02')
self.normal02 = normal02_
elif nodeName_ == 'default01':
elif nodeName_ == 'default01' and child_.text:
sval_ = child_.text
try:
ival_ = int(sval_)
......@@ -979,7 +979,7 @@ class DefaultType1(GeneratedsSuper):
default02_ = child_.text
default02_ = self.gds_validate_string(default02_, node, 'default02')
self.default02 = default02_
elif nodeName_ == 'normal03':
elif nodeName_ == 'normal03' and child_.text:
sval_ = child_.text
try:
fval_ = float(sval_)
......@@ -987,7 +987,7 @@ class DefaultType1(GeneratedsSuper):
raise_parse_error(child_, 'requires float or double: %s' % exp)
fval_ = self.gds_validate_float(fval_, node, 'normal03')
self.normal03 = fval_
elif nodeName_ == 'normal04':
elif nodeName_ == 'normal04' and child_.text:
sval_ = child_.text
try:
fval_ = float(sval_)
......@@ -995,7 +995,7 @@ class DefaultType1(GeneratedsSuper):
raise_parse_error(child_, 'requires float or double: %s' % exp)
fval_ = self.gds_validate_float(fval_, node, 'normal04')
self.normal04 = fval_
elif nodeName_ == 'default03':
elif nodeName_ == 'default03' and child_.text:
sval_ = child_.text
try:
fval_ = float(sval_)
......@@ -1003,7 +1003,7 @@ class DefaultType1(GeneratedsSuper):
raise_parse_error(child_, 'requires float or double: %s' % exp)
fval_ = self.gds_validate_float(fval_, node, 'default03')
self.default03 = fval_
elif nodeName_ == 'default04':
elif nodeName_ == 'default04' and child_.text:
sval_ = child_.text
try:
fval_ = float(sval_)
......
......@@ -955,7 +955,7 @@ class DefaultType1(GeneratedsSuper):
def buildAttributes(self, node, attrs, already_processed):
pass
def buildChildren(self, child_, node, nodeName_, fromsubclass_=False):
if nodeName_ == 'normal01':
if nodeName_ == 'normal01' and child_.text:
sval_ = child_.text
try:
ival_ = int(sval_)
......@@ -967,7 +967,7 @@ class DefaultType1(GeneratedsSuper):
normal02_ = child_.text
normal02_ = self.gds_validate_string(normal02_, node, 'normal02')
self.normal02 = normal02_
elif nodeName_ == 'default01':
elif nodeName_ == 'default01' and child_.text:
sval_ = child_.text
try:
ival_ = int(sval_)
......@@ -979,7 +979,7 @@ class DefaultType1(GeneratedsSuper):
default02_ = child_.text
default02_ = self.gds_validate_string(default02_, node, 'default02')
self.default02 = default02_
elif nodeName_ == 'normal03':
elif nodeName_ == 'normal03' and child_.text:
sval_ = child_.text
try:
fval_ = float(sval_)
......@@ -987,7 +987,7 @@ class DefaultType1(GeneratedsSuper):
raise_parse_error(child_, 'requires float or double: %s' % exp)
fval_ = self.gds_validate_float(fval_, node, 'normal03')
self.normal03 = fval_
elif nodeName_ == 'normal04':
elif nodeName_ == 'normal04' and child_.text:
sval_ = child_.text
try:
fval_ = float(sval_)
......@@ -995,7 +995,7 @@ class DefaultType1(GeneratedsSuper):
raise_parse_error(child_, 'requires float or double: %s' % exp)
fval_ = self.gds_validate_float(fval_, node, 'normal04')
self.normal04 = fval_
elif nodeName_ == 'default03':
elif nodeName_ == 'default03' and child_.text:
sval_ = child_.text
try:
fval_ = float(sval_)
......@@ -1003,7 +1003,7 @@ class DefaultType1(GeneratedsSuper):
raise_parse_error(child_, 'requires float or double: %s' % exp)
fval_ = self.gds_validate_float(fval_, node, 'default03')
self.default03 = fval_
elif nodeName_ == 'default04':
elif nodeName_ == 'default04' and child_.text:
sval_ = child_.text
try:
fval_ = float(sval_)
......
......@@ -1039,7 +1039,7 @@ class DefaultType1(GeneratedsSuper):
def buildAttributes(self, node, attrs, already_processed):
pass
def buildChildren(self, child_, node, nodeName_, fromsubclass_=False):
if nodeName_ == 'default01':
if nodeName_ == 'default01' and child_.text:
sval_ = child_.text
try:
ival_ = int(sval_)
......@@ -1047,7 +1047,7 @@ class DefaultType1(GeneratedsSuper):
raise_parse_error(child_, 'requires integer: %s' % exp)
ival_ = self.gds_validate_integer(ival_, node, 'default01')
self.default01 = ival_
elif nodeName_ == 'normal01':
elif nodeName_ == 'normal01' and child_.text:
sval_ = child_.text
try:
ival_ = int(sval_)
......@@ -1063,7 +1063,7 @@ class DefaultType1(GeneratedsSuper):
normal02_ = child_.text
normal02_ = self.gds_validate_string(normal02_, node, 'normal02')
self.normal02 = normal02_
elif nodeName_ == 'default03':
elif nodeName_ == 'default03' and child_.text:
sval_ = child_.text
try:
fval_ = float(sval_)
......@@ -1071,7 +1071,7 @@ class DefaultType1(GeneratedsSuper):
raise_parse_error(child_, 'requires float or double: %s' % exp)
fval_ = self.gds_validate_float(fval_, node, 'default03')
self.default03 = fval_
elif nodeName_ == 'normal03':
elif nodeName_ == 'normal03' and child_.text:
sval_ = child_.text
try:
fval_ = float(sval_)
......@@ -1079,7 +1079,7 @@ class DefaultType1(GeneratedsSuper):
raise_parse_error(child_, 'requires float or double: %s' % exp)
fval_ = self.gds_validate_float(fval_, node, 'normal03')
self.normal03 = fval_
elif nodeName_ == 'default04':
elif nodeName_ == 'default04' and child_.text:
sval_ = child_.text
try:
fval_ = float(sval_)
......@@ -1087,7 +1087,7 @@ class DefaultType1(GeneratedsSuper):
raise_parse_error(child_, 'requires float or double: %s' % exp)
fval_ = self.gds_validate_float(fval_, node, 'default04')
self.default04 = fval_
elif nodeName_ == 'normal04':
elif nodeName_ == 'normal04' and child_.text:
sval_ = child_.text
try:
fval_ = float(sval_)
......@@ -1374,7 +1374,7 @@ class DefaultType2(GeneratedsSuper):
def buildAttributes(self, node, attrs, already_processed):
pass
def buildChildren(self, child_, node, nodeName_, fromsubclass_=False):
if nodeName_ == 'default01':
if nodeName_ == 'default01' and child_.text:
sval_ = child_.text
try:
ival_ = int(sval_)
......@@ -1382,7 +1382,7 @@ class DefaultType2(GeneratedsSuper):
raise_parse_error(child_, 'requires integer: %s' % exp)
ival_ = self.gds_validate_integer(ival_, node, 'default01')
self.default01 = ival_
elif nodeName_ == 'normal01':
elif nodeName_ == 'normal01' and child_.text:
sval_ = child_.text
try:
ival_ = int(sval_)
......@@ -1398,7 +1398,7 @@ class DefaultType2(GeneratedsSuper):
normal02_ = child_.text
normal02_ = self.gds_validate_string(normal02_, node, 'normal02')
self.normal02 = normal02_