diff --git a/README.rst b/README.rst index 53a8984fcf13d20d73177f0df29d452c7b791bd7..23c832be25da4b4257647a4307cb892d4305f99d 100644 --- a/README.rst +++ b/README.rst @@ -141,6 +141,12 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Change history -------------- +Version 2.29.0 (11/28/2017) + +- Fixes to export of namespace prefixes for schemas that are + imported. Thanks to Bob Barcklay for reporting this and for + advise on fixes. + Version 2.28.2 (10/27/2017) - Changed name/version number scheme to all numeric with dots. diff --git a/generateDS.py b/generateDS.py index 7e741ca0f6d33ccf6d09ffd355c1b6047687e7ec..3da466212e3ec20905eda9cddc3d7133e25f444f 100755 --- a/generateDS.py +++ b/generateDS.py @@ -227,7 +227,7 @@ logging.disable(logging.INFO) # Do not modify the following VERSION comments. # Used by updateversion.py. ##VERSION## -VERSION = '2.28.2' +VERSION = '2.29.0' ##VERSION## if sys.version_info.major == 2: @@ -2001,6 +2001,10 @@ def generateExportFn_1(wrt, child, name, namespace, fill): cleanName = cleanupName(name) mappedName = mapName(cleanName) child_type = child.getType() + if child.prefix and 'ref' in child.attrs: + child_ns = "%s:" % child.prefix + else: + child_ns = namespace if child_type == DateTimeType: default = child.getDefault() if default is None: @@ -2009,10 +2013,10 @@ def generateExportFn_1(wrt, child, name, namespace, fill): wrt('%s if self.%s != "%s":\n' % ( fill, mappedName, default, )) wrt('%s showIndent(outfile, level, pretty_print)\n' % fill) - s1 = "%s outfile.write('<%%s%s>%%s</%%s%s>%%s' %% " \ - "(namespace_, self.gds_format_datetime(self.%s, " \ - "input_name='%s'), namespace_, eol_))\n" % \ - (fill, name, name, mappedName, name, ) + s1 = "%s outfile.write('<%s%s>%%s</%s%s>%%s' %% " \ + "(self.gds_format_datetime(self.%s, " \ + "input_name='%s'), eol_))\n" % \ + (fill, child_ns, name, child_ns, name, mappedName, name, ) wrt(s1) elif child_type == DateType: default = child.getDefault() @@ -2022,10 +2026,10 @@ def generateExportFn_1(wrt, child, name, namespace, fill): wrt('%s if self.%s != "%s":\n' % ( fill, mappedName, default, )) wrt('%s showIndent(outfile, level, pretty_print)\n' % fill) - s1 = "%s outfile.write('<%%s%s>%%s</%%s%s>%%s' %% " \ - "(namespace_, self.gds_format_date(self.%s, " \ - "input_name='%s'), namespace_, eol_))\n" % \ - (fill, name, name, mappedName, name, ) + s1 = "%s outfile.write('<%s%s>%%s</%s%s>%%s' %% " \ + "(self.gds_format_date(self.%s, " \ + "input_name='%s'), eol_))\n" % \ + (fill, child_ns, name, child_ns, name, mappedName, name, ) wrt(s1) elif child_type == TimeType: default = child.getDefault() @@ -2035,10 +2039,10 @@ def generateExportFn_1(wrt, child, name, namespace, fill): wrt('%s if self.%s != "%s":\n' % ( fill, mappedName, default, )) wrt('%s showIndent(outfile, level, pretty_print)\n' % fill) - s1 = "%s outfile.write('<%%s%s>%%s</%%s%s>%%s' %% " \ - "(namespace_, self.gds_format_time(self.%s, " \ - "input_name='%s'), namespace_, eol_))\n" % \ - (fill, name, name, mappedName, name, ) + s1 = "%s outfile.write('<%s%s>%%s</%s%s>%%s' %% " \ + "(self.gds_format_time(self.%s, " \ + "input_name='%s'), eol_))\n" % \ + (fill, child_ns, name, child_ns, name, mappedName, name, ) wrt(s1) elif (child_type in StringType or child_type == TokenType or @@ -2053,23 +2057,23 @@ def generateExportFn_1(wrt, child, name, namespace, fill): # fixlist if (child.getSimpleType() in SimpleTypeDict and SimpleTypeDict[child.getSimpleType()].isListType()): - s1 = "%s outfile.write('<%%s%s>%%s</%%s%s>%%s' %% " \ - "(namespace_, self.gds_encode(self.gds_format_string(" \ + s1 = "%s outfile.write('<%s%s>%%s</%s%s>%%s' %% " \ + "(self.gds_encode(self.gds_format_string(" \ "quote_xml" \ "(' '.join(self.%s)), " \ - "input_name='%s')), namespace_, eol_))\n" % \ - (fill, name, name, mappedName, name, ) + "input_name='%s')), eol_))\n" % \ + (fill, child_ns, name, child_ns, name, mappedName, name, ) else: namespace = 'namespace_' if child.prefix and 'ref' in child.attrs: namespace = "'%s:'" % child.prefix - s1 = "%s outfile.write('<%%s%s>%%s</%%s%s>%%s' %% " \ - "(%s, self.gds_encode(self.gds_format_string(" \ + s1 = "%s outfile.write('<%s%s>%%s</%s%s>%%s' %% " \ + "(self.gds_encode(self.gds_format_string(" \ "quote_xml(self.%s), " \ "input_name='%s')), " \ - "%s, eol_))\n" % \ - (fill, name, name, namespace, mappedName, - name, namespace, ) + "eol_))\n" % \ + (fill, child_ns, name, child_ns, name, mappedName, + name, ) wrt(s1) elif (child_type in IntegerType or child_type == PositiveIntegerType or @@ -2084,15 +2088,15 @@ def generateExportFn_1(wrt, child, name, namespace, fill): fill, mappedName, default, )) wrt('%s showIndent(outfile, level, pretty_print)\n' % fill) if child.isListType(): - s1 = "%s outfile.write('<%%s%s>%%s</%%s%s>%%s' %% " \ - "(namespace_, self.gds_format_integer_list(self.%s, " \ - "input_name='%s'), namespace_, eol_))\n" % \ - (fill, name, name, mappedName, name, ) + s1 = "%s outfile.write('<%s%s>%%s</%s%s>%%s' %% " \ + "(self.gds_format_integer_list(self.%s, " \ + "input_name='%s'), eol_))\n" % \ + (fill, child_ns, name, child_ns, name, mappedName, name, ) else: - s1 = "%s outfile.write('<%%s%s>%%s</%%s%s>%%s' %% " \ - "(namespace_, self.gds_format_integer(self.%s, " \ - "input_name='%s'), namespace_, eol_))\n" % \ - (fill, name, name, mappedName, name, ) + s1 = "%s outfile.write('<%s%s>%%s</%s%s>%%s' %% " \ + "(self.gds_format_integer(self.%s, " \ + "input_name='%s'), eol_))\n" % \ + (fill, child_ns, name, child_ns, name, mappedName, name, ) wrt(s1) elif child_type == BooleanType: default = child.getDefault() @@ -2108,16 +2112,16 @@ def generateExportFn_1(wrt, child, name, namespace, fill): fill, mappedName, )) wrt('%s showIndent(outfile, level, pretty_print)\n' % fill) if child.isListType(): - s1 = "%s outfile.write('<%%s%s>%%s</%%s%s>%%s' %% " \ - "(namespace_, self.gds_format_boolean_list(" \ + s1 = "%s outfile.write('<%s%s>%%s</%s%s>%%s' %% " \ + "(self.gds_format_boolean_list(" \ "self.%s, input_name='%s'), " \ - "namespace_, eol_))\n" % ( - fill, name, name, mappedName, name, ) + "eol_))\n" % ( + fill, child_ns, name, child_ns, name, mappedName, name, ) else: - s1 = "%s outfile.write('<%%s%s>%%s</%%s%s>%%s' %% " \ - "(namespace_, self.gds_format_boolean(" \ - "self.%s, input_name='%s'), namespace_, eol_))\n" % ( - fill, name, name, mappedName, name, ) + s1 = "%s outfile.write('<%s%s>%%s</%s%s>%%s' %% " \ + "(self.gds_format_boolean(" \ + "self.%s, input_name='%s'), eol_))\n" % ( + fill, child_ns, name, child_ns, name, mappedName, name, ) wrt(s1) elif (child_type == FloatType or child_type == DecimalType): @@ -2129,15 +2133,15 @@ def generateExportFn_1(wrt, child, name, namespace, fill): fill, mappedName, default, )) wrt('%s showIndent(outfile, level, pretty_print)\n' % fill) if child.isListType(): - s1 = "%s outfile.write('<%%s%s>%%s</%%s%s>%%s' %% " \ - "(namespace_, self.gds_format_float_list(self.%s, " \ - "input_name='%s'), namespace_, eol_))\n" % \ - (fill, name, name, mappedName, name, ) + s1 = "%s outfile.write('<%s%s>%%s</%s%s>%%s' %% " \ + "(self.gds_format_float_list(self.%s, " \ + "input_name='%s'), eol_))\n" % \ + (fill, child_ns, name, child_ns, name, mappedName, name, ) else: - s1 = "%s outfile.write('<%%s%s>%%s</%%s%s>%%s' %% " \ - "(namespace_, self.gds_format_float(self.%s, " \ - "input_name='%s'), namespace_, eol_))\n" % \ - (fill, name, name, mappedName, name, ) + s1 = "%s outfile.write('<%s%s>%%s</%s%s>%%s' %% " \ + "(self.gds_format_float(self.%s, " \ + "input_name='%s'), eol_))\n" % \ + (fill, child_ns, name, child_ns, name, mappedName, name, ) wrt(s1) elif child_type == DoubleType: default = child.getDefault() @@ -2148,23 +2152,23 @@ def generateExportFn_1(wrt, child, name, namespace, fill): fill, mappedName, default, )) wrt('%s showIndent(outfile, level, pretty_print)\n' % fill) if child.isListType(): - s1 = "%s outfile.write('<%%s%s>%%s</%%s%s>%%s' %% " \ - "(namespace_, self.gds_format_double_list(self.%s, " \ - "input_name='%s'), namespace_, eol_))\n" % \ - (fill, name, name, mappedName, name, ) + s1 = "%s outfile.write('<%s%s>%%s</%s%s>%%s' %% " \ + "(self.gds_format_double_list(self.%s, " \ + "input_name='%s'), eol_))\n" % \ + (fill, child_ns, name, child_ns, name, mappedName, name, ) else: - s1 = "%s outfile.write('<%%s%s>%%s</%%s%s>%%s' %% " \ - "(namespace_, self.gds_format_double(self.%s, " \ - "input_name='%s'), namespace_, eol_))\n" % \ - (fill, name, name, mappedName, name, ) + s1 = "%s outfile.write('<%s%s>%%s</%s%s>%%s' %% " \ + "(self.gds_format_double(self.%s, " \ + "input_name='%s'), eol_))\n" % \ + (fill, child_ns, name, child_ns, name, mappedName, name, ) wrt(s1) elif child_type == Base64Type: wrt('%s if self.%s is not None:\n' % (fill, mappedName, )) wrt('%s showIndent(outfile, level, pretty_print)\n' % fill) - s1 = "%s outfile.write('<%%s%s>%%s</%%s%s>%%s' %% " \ - "(namespace_, self.gds_format_base64(self.%s, input_name='%s'), " \ - "namespace_, eol_))\n" % \ - (fill, name, name, mappedName, name, ) + s1 = ("%s outfile.write('<%s%s>%%s</%s%s>%%s' %% " + "(self.gds_format_base64(self.%s, input_name='%s'), " + "eol_))\n" % ( + fill, child_ns, name, child_ns, name, mappedName, name, )) wrt(s1) else: wrt("%s if self.%s is not None:\n" % (fill, mappedName)) @@ -2188,38 +2192,42 @@ def generateExportFn_2(wrt, child, name, namespace, fill): cleanName = cleanupName(name) mappedName = mapName(cleanName) child_type = child.getType() + if child.prefix and 'ref' in child.attrs: + child_ns = "%s:" % child.prefix + else: + child_ns = namespace # fix_simpletype wrt("%s for %s_ in self.%s:\n" % (fill, cleanName, mappedName, )) if child_type == DateTimeType: wrt('%s showIndent(outfile, level, pretty_print)\n' % fill) - s1 = "%s outfile.write('<%%s%s>%%s</%%s%s>%%s' %% " \ - "(namespace_, self.gds_format_datetime(%s_, input_name='%s')" \ - ", namespace_, eol_))\n" % \ - (fill, name, name, cleanName, name, ) + s1 = "%s outfile.write('<%s%s>%%s</%s%s>%%s' %% " \ + "(self.gds_format_datetime(%s_, input_name='%s')" \ + ", eol_))\n" % \ + (fill, child_ns, name, child_ns, name, cleanName, name, ) wrt(s1) elif child_type == DateType: wrt('%s showIndent(outfile, level, pretty_print)\n' % fill) - s1 = "%s outfile.write('<%%s%s>%%s</%%s%s>%%s' %% " \ - "(namespace_, self.gds_format_date(%s_, input_name='%s'), " \ - "namespace_, eol_))\n" % \ - (fill, name, name, cleanName, name, ) + s1 = "%s outfile.write('<%s%s>%%s</%s%s>%%s' %% " \ + "(self.gds_format_date(%s_, input_name='%s'), " \ + "eol_))\n" % \ + (fill, child_ns, name, child_ns, name, cleanName, name, ) wrt(s1) elif child_type == TimeType: wrt('%s showIndent(outfile, level, pretty_print)\n' % fill) - s1 = "%s outfile.write('<%%s%s>%%s</%%s%s>%%s' %% " \ - "(namespace_, self.gds_format_time(%s_, input_name='%s'), " \ - "namespace_, eol_))\n" % \ - (fill, name, name, cleanName, name, ) + s1 = "%s outfile.write('<%s%s>%%s</%s%s>%%s' %% " \ + "(self.gds_format_time(%s_, input_name='%s'), " \ + "eol_))\n" % \ + (fill, child_ns, name, child_ns, name, cleanName, name, ) wrt(s1) elif (child_type in StringType or child_type == TokenType or child_type in DateTimeGroupType): wrt('%s showIndent(outfile, level, pretty_print)\n' % fill) - wrt("%s outfile.write('<%%s%s>%%s</%%s%s>%%s' %% " - "(namespace_, self.gds_encode(self.gds_format_string(" + wrt("%s outfile.write('<%s%s>%%s</%s%s>%%s' %% " + "(self.gds_encode(self.gds_format_string(" "quote_xml(%s_), " - "input_name='%s')), namespace_, eol_))\n" % - (fill, name, name, cleanName, name,)) + "input_name='%s')), eol_))\n" % + (fill, child_ns, name, child_ns, name, cleanName, name,)) elif (child_type in IntegerType or child_type == PositiveIntegerType or child_type == NonPositiveIntegerType or @@ -2227,64 +2235,64 @@ def generateExportFn_2(wrt, child, name, namespace, fill): child_type == NonNegativeIntegerType): wrt('%s showIndent(outfile, level, pretty_print)\n' % fill) if child.isListType(): - s1 = "%s outfile.write('<%%s%s>%%s</%%s%s>%%s' %% " \ - "(namespace_, self.gds_format_integer_list(" \ - "%s_, input_name='%s'), namespace_, eol_))\n" % \ - (fill, name, name, cleanName, name, ) + s1 = "%s outfile.write('<%s%s>%%s</%s%s>%%s' %% " \ + "(self.gds_format_integer_list(" \ + "%s_, input_name='%s'), eol_))\n" % \ + (fill, child_ns, name, child_ns, name, cleanName, name, ) else: - s1 = "%s outfile.write('<%%s%s>%%s</%%s%s>%%s' %% " \ - "(namespace_, self.gds_format_integer(%s_, " \ - "input_name='%s'), namespace_, eol_))\n" % \ - (fill, name, name, cleanName, name, ) + s1 = "%s outfile.write('<%s%s>%%s</%s%s>%%s' %% " \ + "(self.gds_format_integer(%s_, " \ + "input_name='%s'), eol_))\n" % \ + (fill, child_ns, name, child_ns, name, cleanName, name, ) wrt(s1) elif child_type == BooleanType: wrt('%s showIndent(outfile, level, pretty_print)\n' % fill) if child.isListType(): - s1 = "%s outfile.write('<%%s%s>%%s</%%s%s>%%s' %% " \ - "(namespace_, self.gds_format_boolean_list(" \ + s1 = "%s outfile.write('<%s%s>%%s</%s%s>%%s' %% " \ + "(self.gds_format_boolean_list(" \ "%s_, input_name='%s'), " \ - "namespace_, eol_))\n" % \ - (fill, name, name, cleanName, name, ) + "eol_))\n" % \ + (fill, child_ns, name, child_ns, name, cleanName, name, ) else: - s1 = "%s outfile.write('<%%s%s>%%s</%%s%s>%%s' %% " \ - "(namespace_, self.gds_format_boolean(" \ + s1 = "%s outfile.write('<%s%s>%%s</%s%s>%%s' %% " \ + "(self.gds_format_boolean(" \ "%s_, input_name='%s'), " \ - "namespace_, eol_))\n" % \ - (fill, name, name, cleanName, name, ) + "eol_))\n" % \ + (fill, child_ns, name, child_ns, name, cleanName, name, ) wrt(s1) elif (child_type == FloatType or child_type == DecimalType): wrt('%s showIndent(outfile, level, pretty_print)\n' % fill) if child.isListType(): - s1 = "%s outfile.write('<%%s%s>%%s</%%s%s>%%s' %% " \ - "(namespace_, self.gds_format_float_list(%s_, " \ - "input_name='%s'), namespace_, eol_))\n" % \ - (fill, name, name, cleanName, name, ) + s1 = "%s outfile.write('<%s%s>%%s</%s%s>%%s' %% " \ + "(self.gds_format_float_list(%s_, " \ + "input_name='%s'), eol_))\n" % \ + (fill, child_ns, name, child_ns, name, cleanName, name, ) else: - s1 = "%s outfile.write('<%%s%s>%%s</%%s%s>%%s' %% " \ - "(namespace_, self.gds_format_float(" \ - "%s_, input_name='%s'), namespace_, eol_))\n" % \ - (fill, name, name, cleanName, name, ) + s1 = "%s outfile.write('<%s%s>%%s</%s%s>%%s' %% " \ + "(self.gds_format_float(" \ + "%s_, input_name='%s'), eol_))\n" % \ + (fill, child_ns, name, child_ns, name, cleanName, name, ) wrt(s1) elif child_type == DoubleType: wrt('%s showIndent(outfile, level, pretty_print)\n' % fill) if child.isListType(): - s1 = "%s outfile.write('<%%s%s>%%s</%%s%s>%%s' %% " \ - "(namespace_, self.gds_format_double_list(" \ - "%s_, input_name='%s'), namespace_, eol_))\n" % \ - (fill, name, name, cleanName, name, ) + s1 = "%s outfile.write('<%s%s>%%s</%s%s>%%s' %% " \ + "(self.gds_format_double_list(" \ + "%s_, input_name='%s'), eol_))\n" % \ + (fill, child_ns, name, child_ns, name, cleanName, name, ) else: - s1 = "%s outfile.write('<%%s%s>%%s</%%s%s>%%s' %% " \ - "(namespace_, self.gds_format_double(%s_, input_name='%s'), " \ - "namespace_, eol_))\n" % \ - (fill, name, name, cleanName, name, ) + s1 = "%s outfile.write('<%s%s>%%s</%s%s>%%s' %% " \ + "(self.gds_format_double(%s_, input_name='%s'), " \ + "eol_))\n" % \ + (fill, child_ns, name, child_ns, name, cleanName, name, ) wrt(s1) elif child_type == Base64Type: wrt('%s showIndent(outfile, level, pretty_print)\n' % fill) - s1 = "%s outfile.write('<%%s%s>%%s</%%s%s>%%s' %% " \ - "(namespace_, self.gds_format_base64(%s_, input_name='%s'), " \ - "namespace_, eol_))\n" % \ - (fill, name, name, cleanName, name, ) + s1 = "%s outfile.write('<%s%s>%%s</%s%s>%%s' %% " \ + "(self.gds_format_base64(%s_, input_name='%s'), " \ + "eol_))\n" % \ + (fill, child_ns, name, child_ns, name, cleanName, name, ) wrt(s1) else: # name_type_problem @@ -2306,6 +2314,10 @@ def generateExportFn_3(wrt, child, name, namespace, fill): cleanName = cleanupName(name) mappedName = mapName(cleanName) child_type = child.getType() + if child.prefix and 'ref' in child.attrs: + child_ns = "%s:" % child.prefix + else: + child_ns = namespace # fix_simpletype if child_type == DateTimeType: default = child.getDefault() @@ -2315,10 +2327,10 @@ def generateExportFn_3(wrt, child, name, namespace, fill): wrt('%s if self.%s != "%s":\n' % ( fill, mappedName, default, )) wrt('%s showIndent(outfile, level, pretty_print)\n' % fill) - s1 = "%s outfile.write('<%%s%s>%%s</%%s%s>%%s' %% " \ - "(namespace_, self.gds_format_datetime(" \ - "self.%s, input_name='%s'), namespace_, eol_))\n" % \ - (fill, name, name, mappedName, name, ) + s1 = "%s outfile.write('<%s%s>%%s</%s%s>%%s' %% " \ + "(self.gds_format_datetime(" \ + "self.%s, input_name='%s'), eol_))\n" % \ + (fill, child_ns, name, child_ns, name, mappedName, name, ) wrt(s1) elif child_type == DateType: default = child.getDefault() @@ -2328,10 +2340,10 @@ def generateExportFn_3(wrt, child, name, namespace, fill): wrt('%s if self.%s != "%s":\n' % ( fill, mappedName, default, )) wrt('%s showIndent(outfile, level, pretty_print)\n' % fill) - s1 = "%s outfile.write('<%%s%s>%%s</%%s%s>%%s' %% " \ - "(namespace_, self.gds_format_date(" \ - "self.%s, input_name='%s'), namespace_, eol_))\n" % \ - (fill, name, name, mappedName, name, ) + s1 = "%s outfile.write('<%s%s>%%s</%s%s>%%s' %% " \ + "(self.gds_format_date(" \ + "self.%s, input_name='%s'), eol_))\n" % \ + (fill, child_ns, name, child_ns, name, mappedName, name, ) wrt(s1) elif child_type == TimeType: default = child.getDefault() @@ -2341,10 +2353,10 @@ def generateExportFn_3(wrt, child, name, namespace, fill): wrt('%s if self.%s != "%s":\n' % ( fill, mappedName, default, )) wrt('%s showIndent(outfile, level, pretty_print)\n' % fill) - s1 = "%s outfile.write('<%%s%s>%%s</%%s%s>%%s' %% " \ - "(namespace_, self.gds_format_time(" \ - "self.%s, input_name='%s'), namespace_, eol_))\n" % \ - (fill, name, name, mappedName, name, ) + s1 = "%s outfile.write('<%s%s>%%s</%s%s>%%s' %% " \ + "(self.gds_format_time(" \ + "self.%s, input_name='%s'), eol_))\n" % \ + (fill, child_ns, name, child_ns, name, mappedName, name, ) wrt(s1) elif (child_type in StringType or child_type == TokenType or @@ -2359,17 +2371,17 @@ def generateExportFn_3(wrt, child, name, namespace, fill): # fixlist if (child.getSimpleType() in SimpleTypeDict and SimpleTypeDict[child.getSimpleType()].isListType()): - s1 = "%s outfile.write('<%%s%s>%%s</%%s%s>%%s' %% " \ - "(namespace_, self.gds_encode(self.gds_format_string(" \ + s1 = "%s outfile.write('<%s%s>%%s</%s%s>%%s' %% " \ + "(self.gds_encode(self.gds_format_string(" \ "quote_xml(' '.join(self.%s)), " \ - "input_name='%s')), namespace_, eol_))\n" % \ - (fill, name, name, mappedName, name, ) + "input_name='%s')), eol_))\n" % \ + (fill, child_ns, name, child_ns, name, mappedName, name, ) else: - s1 = "%s outfile.write('<%%s%s>%%s</%%s%s>%%s' %% " \ - "(namespace_, self.gds_encode(self.gds_format_string(" \ + s1 = "%s outfile.write('<%s%s>%%s</%s%s>%%s' %% " \ + "(self.gds_encode(self.gds_format_string(" \ "quote_xml(self.%s), " \ - "input_name='%s')), namespace_, eol_))\n" % \ - (fill, name, name, mappedName, name, ) + "input_name='%s')), eol_))\n" % \ + (fill, child_ns, name, child_ns, name, mappedName, name, ) wrt(s1) elif (child_type in IntegerType or child_type == PositiveIntegerType or @@ -2384,15 +2396,15 @@ def generateExportFn_3(wrt, child, name, namespace, fill): fill, mappedName, default, )) wrt('%s showIndent(outfile, level, pretty_print)\n' % fill) if child.isListType(): - s1 = "%s outfile.write('<%%s%s>%%s</%%s%s>%%s' %% " \ - "(namespace_, self.gds_format_integer_list(" \ - "self.%s, input_name='%s'), namespace_, eol_))\n" % \ - (fill, name, name, mappedName, name, ) + s1 = "%s outfile.write('<%s%s>%%s</%s%s>%%s' %% " \ + "(self.gds_format_integer_list(" \ + "self.%s, input_name='%s'), eol_))\n" % \ + (fill, child_ns, name, child_ns, name, mappedName, name, ) else: - s1 = "%s outfile.write('<%%s%s>%%s</%%s%s>%%s' %% " \ - "(namespace_, self.gds_format_integer(" \ - "self.%s, input_name='%s'), namespace_, eol_))\n" % \ - (fill, name, name, mappedName, name, ) + s1 = "%s outfile.write('<%s%s>%%s</%s%s>%%s' %% " \ + "(self.gds_format_integer(" \ + "self.%s, input_name='%s'), eol_))\n" % \ + (fill, child_ns, name, child_ns, name, mappedName, name, ) wrt(s1) elif child_type == BooleanType: default = child.getDefault() @@ -2408,16 +2420,17 @@ def generateExportFn_3(wrt, child, name, namespace, fill): fill, mappedName, )) wrt('%s showIndent(outfile, level, pretty_print)\n' % fill) if child.isListType(): - s1 = "%s outfile.write('<%%s%s>%%s</%%s%s>%%s' %% " \ - "(namespace_, self.gds_format_boolean_list(" \ + s1 = "%s outfile.write('<%s%s>%%s</%s%s>%%s' %% " \ + "(self.gds_format_boolean_list(" \ "self.%s, input_name='%s'), " \ - "namespace_, eol_))\n" % \ - (fill, name, name, mappedName, name) + "eol_))\n" % \ + (fill, child_ns, name, child_ns, name, mappedName, name) else: - s1 = "%s outfile.write('<%%s%s>%%s</%%s%s>%%s' %% " \ - "(namespace_, self.gds_format_boolean(" \ + s1 = "%s outfile.write('<%s%s>%%s</%s%s>%%s' %% " \ + "(self.gds_format_boolean(" \ "self.%s, input_name='%s'), " \ - "namespace_, eol_))\n" % (fill, name, name, mappedName, name) + "eol_))\n" % ( + fill, child_ns, name, child_ns, name, mappedName, name) wrt(s1) elif (child_type == FloatType or child_type == DecimalType): @@ -2429,15 +2442,15 @@ def generateExportFn_3(wrt, child, name, namespace, fill): fill, mappedName, default, )) wrt('%s showIndent(outfile, level, pretty_print)\n' % fill) if child.isListType(): - s1 = "%s outfile.write('<%%s%s>%%s</%%s%s>%%s' %% " \ - "(namespace_, self.gds_format_float_list(" \ - "self.%s, input_name='%s'), namespace_, eol_))\n" % \ - (fill, name, name, mappedName, name, ) + s1 = "%s outfile.write('<%s%s>%%s</%s%s>%%s' %% " \ + "(self.gds_format_float_list(" \ + "self.%s, input_name='%s'), eol_))\n" % \ + (fill, child_ns, name, child_ns, name, mappedName, name, ) else: - s1 = "%s outfile.write('<%%s%s>%%s</%%s%s>%%s' %% " \ - "(namespace_, self.gds_format_float(" \ - "self.%s, input_name='%s'), namespace_, eol_))\n" % \ - (fill, name, name, mappedName, name, ) + s1 = "%s outfile.write('<%s%s>%%s</%s%s>%%s' %% " \ + "(self.gds_format_float(" \ + "self.%s, input_name='%s'), eol_))\n" % \ + (fill, child_ns, name, child_ns, name, mappedName, name, ) wrt(s1) elif child_type == DoubleType: default = child.getDefault() @@ -2448,23 +2461,23 @@ def generateExportFn_3(wrt, child, name, namespace, fill): fill, mappedName, default, )) wrt('%s showIndent(outfile, level, pretty_print)\n' % fill) if child.isListType(): - s1 = "%s outfile.write('<%%s%s>%%s</%%s%s>%%s' %% " \ - "(namespace_, self.gds_format_double_list(" \ - "self.%s, input_name='%s'), namespace_, eol_))\n" % \ - (fill, name, name, mappedName, name, ) + s1 = "%s outfile.write('<%s%s>%%s</%s%s>%%s' %% " \ + "(self.gds_format_double_list(" \ + "self.%s, input_name='%s'), eol_))\n" % \ + (fill, child_ns, name, child_ns, name, mappedName, name, ) else: - s1 = "%s outfile.write('<%%s%s>%%s</%%s%s>%%s' %% " \ - "(namespace_, self.gds_format_double(" \ - "self.%s, input_name='%s'), namespace_, eol_))\n" % \ - (fill, name, name, mappedName, name, ) + s1 = "%s outfile.write('<%s%s>%%s</%s%s>%%s' %% " \ + "(self.gds_format_double(" \ + "self.%s, input_name='%s'), eol_))\n" % \ + (fill, child_ns, name, child_ns, name, mappedName, name, ) wrt(s1) elif child_type == Base64Type: wrt('%s if self.%s is not None:\n' % (fill, mappedName, )) wrt('%s showIndent(outfile, level, pretty_print)\n' % fill) - s1 = "%s outfile.write('<%%s%s>%%s</%%s%s>%%s' %% " \ - "(namespace_, self.gds_format_base64(" \ - "self.%s, input_name='%s'), namespace_, eol_))\n" % \ - (fill, name, name, mappedName, name, ) + s1 = "%s outfile.write('<%s%s>%%s</%s%s>%%s' %% " \ + "(self.gds_format_base64(" \ + "self.%s, input_name='%s'), eol_))\n" % \ + (fill, child_ns, name, child_ns, name, mappedName, name, ) wrt(s1) else: wrt("%s if self.%s is not None:\n" % (fill, mappedName)) diff --git a/generateDS.txt b/generateDS.txt index 7f8c9ae86c608fa2c2cd85a569ee145a47bcbbe3..371b9b616b51c6df5d05ba225a71f4c63ea9657f 100644 --- a/generateDS.txt +++ b/generateDS.txt @@ -12,7 +12,7 @@ generateDS -- Generate Data Structures from XML Schema .. version -:revision: 2.28.2 +:revision: 2.29.0 .. version diff --git a/generateds_gui_notes.txt b/generateds_gui_notes.txt index a068ce28823ea392f04319c72dd563dbe738c73b..af38d1abfc456bca97977def933e008613fe5561 100644 --- a/generateds_gui_notes.txt +++ b/generateds_gui_notes.txt @@ -12,7 +12,7 @@ GenerateDS GUI Notes .. version -:revision: 2.28.2 +:revision: 2.29.0 .. version diff --git a/gui/generateds_gui.py b/gui/generateds_gui.py index 256b2dda8526a5a35a044a8042af01b68b10d91c..bf670dcbaf872e54d4f03314b74e3144fa733862 100644 --- a/gui/generateds_gui.py +++ b/gui/generateds_gui.py @@ -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.28.2' +VERSION = '2.29.0' ##VERSION## diff --git a/librarytemplate_howto.txt b/librarytemplate_howto.txt index e8af426e5103bf8063f0c421156dc14b9d7de1f7..e732d840aead57223eff7154590f4a638820c20f 100644 --- a/librarytemplate_howto.txt +++ b/librarytemplate_howto.txt @@ -8,7 +8,7 @@ How to package a generateDS.py generated library .. version -:revision: 2.28.2 +:revision: 2.29.0 .. version diff --git a/process_includes.py b/process_includes.py index 29e375d0205585db537731b6810a07bdbb5c0c56..7b54239b926f868aabf9035846ab30234656d152 100644 --- a/process_includes.py +++ b/process_includes.py @@ -40,7 +40,7 @@ except ImportError: # Do not modify the following VERSION comments. # Used by updateversion.py. ##VERSION## -VERSION = '2.28.2' +VERSION = '2.29.0' ##VERSION## CatalogDict = {} diff --git a/setup.py b/setup.py index c81aca431d7772f5d345e1f8325d48287e88b730..4bf3b43d2612f5862dbcb7870b8e461e5b567b3f 100644 --- a/setup.py +++ b/setup.py @@ -7,7 +7,7 @@ setup(name="generateDS", # Do not modify the following VERSION comments. # Used by updateversion.py. ##VERSION## - version="2.28.2", + version="2.29.0", ##VERSION## author="Dave Kuhlman", author_email="dkuhlman@davekuhlman.org", diff --git a/tests/OnePer/oneperType00_2One.py b/tests/OnePer/oneperType00_2One.py index c75e149ee1e7fd7dce3e2be3369f98062fab1e38..2bd2128cf3beb38f49a9f508348bcba0519c5d53 100644 --- a/tests/OnePer/oneperType00_2One.py +++ b/tests/OnePer/oneperType00_2One.py @@ -3,7 +3,7 @@ # # Generated by generateDS.py. -# Python 2.7.13 (default, Jan 19 2017, 14:48:08) [GCC 6.3.0 20170118] +# Python 2.7.14 (default, Sep 23 2017, 22:06:14) [GCC 7.2.0] # # Command line options: # ('--no-dates', '') diff --git a/tests/OnePer/oneperType01_2One.py b/tests/OnePer/oneperType01_2One.py index c153546ffeb73fe27a757f835742e771768bc927..f22521e3cbd850c7c2de151eee805f0cd772eb56 100644 --- a/tests/OnePer/oneperType01_2One.py +++ b/tests/OnePer/oneperType01_2One.py @@ -3,7 +3,7 @@ # # Generated by generateDS.py. -# Python 2.7.13 (default, Jan 19 2017, 14:48:08) [GCC 6.3.0 20170118] +# Python 2.7.14 (default, Sep 23 2017, 22:06:14) [GCC 7.2.0] # # Command line options: # ('--no-dates', '') @@ -775,7 +775,7 @@ class oneperType01_1(GeneratedsSuper): eol_ = '' if self.username is not None: showIndent(outfile, level, pretty_print) - outfile.write('<%susername>%s</%susername>%s' % (namespace_, self.gds_encode(self.gds_format_string(quote_xml(self.username), input_name='username')), namespace_, eol_)) + outfile.write('<username>%s</username>%s' % (self.gds_encode(self.gds_format_string(quote_xml(self.username), input_name='username')), eol_)) if self.inner01 is not None: self.inner01.export(outfile, level, namespace_, name_='inner01', pretty_print=pretty_print) def build(self, node): @@ -859,7 +859,7 @@ class oneperType01_2(GeneratedsSuper): eol_ = '' if self.userdescription is not None: showIndent(outfile, level, pretty_print) - outfile.write('<%suserdescription>%s</%suserdescription>%s' % (namespace_, self.gds_encode(self.gds_format_string(quote_xml(self.userdescription), input_name='userdescription')), namespace_, eol_)) + outfile.write('<userdescription>%s</userdescription>%s' % (self.gds_encode(self.gds_format_string(quote_xml(self.userdescription), input_name='userdescription')), eol_)) def build(self, node): already_processed = set() self.buildAttributes(node, node.attrib, already_processed) diff --git a/tests/OnePer/oneperType02_2One.py b/tests/OnePer/oneperType02_2One.py index 7124e4fe62721cc4bdf8e5ee130c71977782a8ed..b7f4e2439e785ff0a34ad886ed72d7aafe3302e8 100644 --- a/tests/OnePer/oneperType02_2One.py +++ b/tests/OnePer/oneperType02_2One.py @@ -3,7 +3,7 @@ # # Generated by generateDS.py. -# Python 2.7.13 (default, Jan 19 2017, 14:48:08) [GCC 6.3.0 20170118] +# Python 2.7.14 (default, Sep 23 2017, 22:06:14) [GCC 7.2.0] # # Command line options: # ('--no-dates', '') @@ -775,7 +775,7 @@ class oneperType02_1(GeneratedsSuper): eol_ = '' if self.clientname is not None: showIndent(outfile, level, pretty_print) - outfile.write('<%sclientname>%s</%sclientname>%s' % (namespace_, self.gds_encode(self.gds_format_string(quote_xml(self.clientname), input_name='clientname')), namespace_, eol_)) + outfile.write('<clientname>%s</clientname>%s' % (self.gds_encode(self.gds_format_string(quote_xml(self.clientname), input_name='clientname')), eol_)) if self.inner01 is not None: self.inner01.export(outfile, level, namespace_, name_='inner01', pretty_print=pretty_print) def build(self, node): @@ -859,7 +859,7 @@ class oneperType02_2(GeneratedsSuper): eol_ = '' if self.clientdescription is not None: showIndent(outfile, level, pretty_print) - outfile.write('<%sclientdescription>%s</%sclientdescription>%s' % (namespace_, self.gds_encode(self.gds_format_string(quote_xml(self.clientdescription), input_name='clientdescription')), namespace_, eol_)) + outfile.write('<clientdescription>%s</clientdescription>%s' % (self.gds_encode(self.gds_format_string(quote_xml(self.clientdescription), input_name='clientdescription')), eol_)) def build(self, node): already_processed = set() self.buildAttributes(node, node.attrib, already_processed) diff --git a/tests/OnePer/oneperType03_2One.py b/tests/OnePer/oneperType03_2One.py index 1d53731875c20eef76ee4f6679ae6c189e1342f3..a240d227e09a385cb5d5b32e0a9a09b647bf01c5 100644 --- a/tests/OnePer/oneperType03_2One.py +++ b/tests/OnePer/oneperType03_2One.py @@ -3,7 +3,7 @@ # # Generated by generateDS.py. -# Python 2.7.13 (default, Jan 19 2017, 14:48:08) [GCC 6.3.0 20170118] +# Python 2.7.14 (default, Sep 23 2017, 22:06:14) [GCC 7.2.0] # # Command line options: # ('--no-dates', '') @@ -775,7 +775,7 @@ class oneperType03_1(GeneratedsSuper): eol_ = '' if self.helpername is not None: showIndent(outfile, level, pretty_print) - outfile.write('<%shelpername>%s</%shelpername>%s' % (namespace_, self.gds_encode(self.gds_format_string(quote_xml(self.helpername), input_name='helpername')), namespace_, eol_)) + outfile.write('<helpername>%s</helpername>%s' % (self.gds_encode(self.gds_format_string(quote_xml(self.helpername), input_name='helpername')), eol_)) if self.inner01 is not None: self.inner01.export(outfile, level, namespace_, name_='inner01', pretty_print=pretty_print) def build(self, node): @@ -859,7 +859,7 @@ class oneperType03_2(GeneratedsSuper): eol_ = '' if self.helperdescription is not None: showIndent(outfile, level, pretty_print) - outfile.write('<%shelperdescription>%s</%shelperdescription>%s' % (namespace_, self.gds_encode(self.gds_format_string(quote_xml(self.helperdescription), input_name='helperdescription')), namespace_, eol_)) + outfile.write('<helperdescription>%s</helperdescription>%s' % (self.gds_encode(self.gds_format_string(quote_xml(self.helperdescription), input_name='helperdescription')), eol_)) def build(self, node): already_processed = set() self.buildAttributes(node, node.attrib, already_processed) diff --git a/tests/README.rst b/tests/README.rst new file mode 100644 index 0000000000000000000000000000000000000000..149077c3058aa0f0a85b2bb5fbfcb258575839f4 --- /dev/null +++ b/tests/README.rst @@ -0,0 +1,19 @@ +============ +Unit Tests +============ + +How to run the unit test +========================== + +To run the unit tests, do:: + + $ cd tests/ # this directory + $ python test.py + +You will need to use Python 2.7 and not Python 3 to run the unit +tests. The unit tests will run under Python 3, but the tests fail. +That's because of (1) differences in the comments at the +top of generated files; (2) some ordering differences, possibly +because of dicts; etc. all of which do not matter when you actually +run the generated code, I believe. + diff --git a/tests/abstract_type1_sub.py b/tests/abstract_type1_sub.py index 4be8db1dfebd3d274f91f12278938a0d7c348d81..3a5a98a6d18a6a72bc6f2fccc63cf1748066eb01 100644 --- a/tests/abstract_type1_sub.py +++ b/tests/abstract_type1_sub.py @@ -2,7 +2,7 @@ # # Generated by generateDS.py. -# Python 2.7.13 (default, Jan 19 2017, 14:48:08) [GCC 6.3.0 20170118] +# Python 2.7.14 (default, Sep 23 2017, 22:06:14) [GCC 7.2.0] # # Command line options: # ('--no-dates', '') diff --git a/tests/abstract_type1_sup.py b/tests/abstract_type1_sup.py index 15da5d65403015ff74506d9a1f4f37c7b1d0e011..af44aab5aa1ed68c68e20e53c9d914ba6d2db9f7 100644 --- a/tests/abstract_type1_sup.py +++ b/tests/abstract_type1_sup.py @@ -3,7 +3,7 @@ # # Generated by generateDS.py. -# Python 2.7.13 (default, Jan 19 2017, 14:48:08) [GCC 6.3.0 20170118] +# Python 2.7.14 (default, Sep 23 2017, 22:06:14) [GCC 7.2.0] # # Command line options: # ('--no-dates', '') diff --git a/tests/annotations1_sub.py b/tests/annotations1_sub.py index bfa0bb3f873d1128ee92326bf73330cb86c06460..a3b9f139d94f624aa73f20d404d301ab493cf035 100644 --- a/tests/annotations1_sub.py +++ b/tests/annotations1_sub.py @@ -2,7 +2,7 @@ # # Generated by generateDS.py. -# Python 2.7.13 (default, Jan 19 2017, 14:48:08) [GCC 6.3.0 20170118] +# Python 2.7.14 (default, Sep 23 2017, 22:06:14) [GCC 7.2.0] # # Command line options: # ('--no-dates', '') diff --git a/tests/annotations1_sup.py b/tests/annotations1_sup.py index 3800940e4c5c8d9d36a1a563a76eebd7db849062..b95527acc3f700656b8186b8a7cd019428ce8901 100644 --- a/tests/annotations1_sup.py +++ b/tests/annotations1_sup.py @@ -3,7 +3,7 @@ # # Generated by generateDS.py. -# Python 2.7.13 (default, Jan 19 2017, 14:48:08) [GCC 6.3.0 20170118] +# Python 2.7.14 (default, Sep 23 2017, 22:06:14) [GCC 7.2.0] # # Command line options: # ('--no-dates', '') @@ -777,7 +777,7 @@ class document1Type(GeneratedsSuper): eol_ = '' if self.comments is not None: showIndent(outfile, level, pretty_print) - outfile.write('<%scomments>%s</%scomments>%s' % (namespace_, self.gds_encode(self.gds_format_string(quote_xml(self.comments), input_name='comments')), namespace_, eol_)) + outfile.write('<comments>%s</comments>%s' % (self.gds_encode(self.gds_format_string(quote_xml(self.comments), input_name='comments')), eol_)) if self.otherdoc is not None: self.otherdoc.export(outfile, level, namespace_, name_='otherdoc', pretty_print=pretty_print) def build(self, node): @@ -874,10 +874,10 @@ class document2Type(GeneratedsSuper): eol_ = '' if self.comments is not None: showIndent(outfile, level, pretty_print) - outfile.write('<%scomments>%s</%scomments>%s' % (namespace_, self.gds_encode(self.gds_format_string(quote_xml(self.comments), input_name='comments')), namespace_, eol_)) + outfile.write('<comments>%s</comments>%s' % (self.gds_encode(self.gds_format_string(quote_xml(self.comments), input_name='comments')), eol_)) if self.rating is not None: showIndent(outfile, level, pretty_print) - outfile.write('<%srating>%s</%srating>%s' % (namespace_, self.gds_format_integer(self.rating, input_name='rating'), namespace_, eol_)) + outfile.write('<rating>%s</rating>%s' % (self.gds_format_integer(self.rating, input_name='rating'), eol_)) if self.anotherdoc is not None: self.anotherdoc.export(outfile, level, namespace_, name_='anotherdoc', pretty_print=pretty_print) def build(self, node): @@ -975,10 +975,10 @@ class document3Type(GeneratedsSuper): eol_ = '' if self.comments is not None: showIndent(outfile, level, pretty_print) - outfile.write('<%scomments>%s</%scomments>%s' % (namespace_, self.gds_encode(self.gds_format_string(quote_xml(self.comments), input_name='comments')), namespace_, eol_)) + outfile.write('<comments>%s</comments>%s' % (self.gds_encode(self.gds_format_string(quote_xml(self.comments), input_name='comments')), eol_)) if self.rating is not None: showIndent(outfile, level, pretty_print) - outfile.write('<%srating>%s</%srating>%s' % (namespace_, self.gds_format_integer(self.rating, input_name='rating'), namespace_, eol_)) + outfile.write('<rating>%s</rating>%s' % (self.gds_format_integer(self.rating, input_name='rating'), eol_)) def build(self, node): already_processed = set() self.buildAttributes(node, node.attrib, already_processed) diff --git a/tests/anonymous_type1_sub.py b/tests/anonymous_type1_sub.py index 02b27ee94a77e70d779d79653614f2a23be99001..3785a39ef1649da098afaa5b42462b4b0893d252 100644 --- a/tests/anonymous_type1_sub.py +++ b/tests/anonymous_type1_sub.py @@ -2,7 +2,7 @@ # # Generated by generateDS.py. -# Python 2.7.13 (default, Jan 19 2017, 14:48:08) [GCC 6.3.0 20170118] +# Python 2.7.14 (default, Sep 23 2017, 22:06:14) [GCC 7.2.0] # # Command line options: # ('--no-dates', '') diff --git a/tests/anonymous_type1_sup.py b/tests/anonymous_type1_sup.py index 9456e9a8513805735948aaf21409e05934cbb2ac..200d52e89b62469ffc5dbe43f3cbc0aed3f17d2e 100644 --- a/tests/anonymous_type1_sup.py +++ b/tests/anonymous_type1_sup.py @@ -3,7 +3,7 @@ # # Generated by generateDS.py. -# Python 2.7.13 (default, Jan 19 2017, 14:48:08) [GCC 6.3.0 20170118] +# Python 2.7.14 (default, Sep 23 2017, 22:06:14) [GCC 7.2.0] # # Command line options: # ('--no-dates', '') @@ -878,7 +878,7 @@ class FooType1(GeneratedsSuper): eol_ = '' if self.FooType is not None: showIndent(outfile, level, pretty_print) - outfile.write('<%sFooType>%s</%sFooType>%s' % (namespace_, self.gds_encode(self.gds_format_string(quote_xml(self.FooType), input_name='FooType')), namespace_, eol_)) + outfile.write('<FooType>%s</FooType>%s' % (self.gds_encode(self.gds_format_string(quote_xml(self.FooType), input_name='FooType')), eol_)) def build(self, node): already_processed = set() self.buildAttributes(node, node.attrib, already_processed) @@ -965,7 +965,7 @@ class BarType2(GeneratedsSuper): eol_ = '' if self.BarType is not None: showIndent(outfile, level, pretty_print) - outfile.write('<%sBarType>%s</%sBarType>%s' % (namespace_, self.gds_encode(self.gds_format_string(quote_xml(self.BarType), input_name='BarType')), namespace_, eol_)) + outfile.write('<BarType>%s</BarType>%s' % (self.gds_encode(self.gds_format_string(quote_xml(self.BarType), input_name='BarType')), eol_)) def build(self, node): already_processed = set() self.buildAttributes(node, node.attrib, already_processed) @@ -1052,7 +1052,7 @@ class BazType3(GeneratedsSuper): eol_ = '' if self.BazType is not None: showIndent(outfile, level, pretty_print) - outfile.write('<%sBazType>%s</%sBazType>%s' % (namespace_, self.gds_encode(self.gds_format_string(quote_xml(self.BazType), input_name='BazType')), namespace_, eol_)) + outfile.write('<BazType>%s</BazType>%s' % (self.gds_encode(self.gds_format_string(quote_xml(self.BazType), input_name='BazType')), eol_)) def build(self, node): already_processed = set() self.buildAttributes(node, node.attrib, already_processed) diff --git a/tests/anysimpletype1_sub.py b/tests/anysimpletype1_sub.py index dacb67376b9e0ae97a0e350b110e015a39667159..172c67803990180213e7776af6c7449166d9c416 100644 --- a/tests/anysimpletype1_sub.py +++ b/tests/anysimpletype1_sub.py @@ -2,7 +2,7 @@ # # Generated by generateDS.py. -# Python 2.7.13 (default, Jan 19 2017, 14:48:08) [GCC 6.3.0 20170118] +# Python 2.7.14 (default, Sep 23 2017, 22:06:14) [GCC 7.2.0] # # Command line options: # ('--no-dates', '') diff --git a/tests/anysimpletype1_sup.py b/tests/anysimpletype1_sup.py index 0ab45b721b92c6f8a55b74f3eb6172210b1a2a91..126c501beef7e6909245006052c5e51adb4c2075 100644 --- a/tests/anysimpletype1_sup.py +++ b/tests/anysimpletype1_sup.py @@ -3,7 +3,7 @@ # # Generated by generateDS.py. -# Python 2.7.13 (default, Jan 19 2017, 14:48:08) [GCC 6.3.0 20170118] +# Python 2.7.14 (default, Sep 23 2017, 22:06:14) [GCC 7.2.0] # # Command line options: # ('--no-dates', '') diff --git a/tests/anywildcard1_sub.py b/tests/anywildcard1_sub.py index dbaa90dc9d8fe1139117318e65f243b735a2299d..1c7ca20cf220081ebf2fc153428f7da0ff5ce049 100644 --- a/tests/anywildcard1_sub.py +++ b/tests/anywildcard1_sub.py @@ -2,7 +2,7 @@ # # Generated by generateDS.py. -# Python 2.7.13 (default, Jan 19 2017, 14:48:08) [GCC 6.3.0 20170118] +# Python 2.7.14 (default, Sep 23 2017, 22:06:14) [GCC 7.2.0] # # Command line options: # ('--no-dates', '') diff --git a/tests/anywildcard1_sup.py b/tests/anywildcard1_sup.py index fce01282fe7597fa748292be626e4aaf1e3b4ef1..95dfc40e454d593c6ccf2d882299dba47ca38adb 100644 --- a/tests/anywildcard1_sup.py +++ b/tests/anywildcard1_sup.py @@ -3,7 +3,7 @@ # # Generated by generateDS.py. -# Python 2.7.13 (default, Jan 19 2017, 14:48:08) [GCC 6.3.0 20170118] +# Python 2.7.14 (default, Sep 23 2017, 22:06:14) [GCC 7.2.0] # # Command line options: # ('--no-dates', '') @@ -779,7 +779,7 @@ class PlantType_single(GeneratedsSuper): eol_ = '' if self.name is not None: showIndent(outfile, level, pretty_print) - outfile.write('<%sname>%s</%sname>%s' % (namespace_, self.gds_encode(self.gds_format_string(quote_xml(self.name), input_name='name')), namespace_, eol_)) + outfile.write('<name>%s</name>%s' % (self.gds_encode(self.gds_format_string(quote_xml(self.name), input_name='name')), eol_)) if self.description is not None: self.description.export(outfile, level, namespace_, name_='description', pretty_print=pretty_print) if self.anytypeobjs_ is not None: @@ -884,7 +884,7 @@ class PlantType_multiple(GeneratedsSuper): eol_ = '' if self.name is not None: showIndent(outfile, level, pretty_print) - outfile.write('<%sname>%s</%sname>%s' % (namespace_, self.gds_encode(self.gds_format_string(quote_xml(self.name), input_name='name')), namespace_, eol_)) + outfile.write('<name>%s</name>%s' % (self.gds_encode(self.gds_format_string(quote_xml(self.name), input_name='name')), eol_)) if self.description is not None: self.description.export(outfile, level, namespace_, name_='description', pretty_print=pretty_print) for obj_ in self.anytypeobjs_: @@ -980,10 +980,10 @@ class DescriptionType(GeneratedsSuper): eol_ = '' if self.name is not None: showIndent(outfile, level, pretty_print) - outfile.write('<%sname>%s</%sname>%s' % (namespace_, self.gds_encode(self.gds_format_string(quote_xml(self.name), input_name='name')), namespace_, eol_)) + outfile.write('<name>%s</name>%s' % (self.gds_encode(self.gds_format_string(quote_xml(self.name), input_name='name')), eol_)) if self.size is not None: showIndent(outfile, level, pretty_print) - outfile.write('<%ssize>%s</%ssize>%s' % (namespace_, self.gds_encode(self.gds_format_string(quote_xml(self.size), input_name='size')), namespace_, eol_)) + outfile.write('<size>%s</size>%s' % (self.gds_encode(self.gds_format_string(quote_xml(self.size), input_name='size')), eol_)) def build(self, node): already_processed = set() self.buildAttributes(node, node.attrib, already_processed) @@ -1070,10 +1070,10 @@ class CatalogType(GeneratedsSuper): eol_ = '' if self.name is not None: showIndent(outfile, level, pretty_print) - outfile.write('<%sname>%s</%sname>%s' % (namespace_, self.gds_encode(self.gds_format_string(quote_xml(self.name), input_name='name')), namespace_, eol_)) + outfile.write('<name>%s</name>%s' % (self.gds_encode(self.gds_format_string(quote_xml(self.name), input_name='name')), eol_)) if self.catagory is not None: showIndent(outfile, level, pretty_print) - outfile.write('<%scatagory>%s</%scatagory>%s' % (namespace_, self.gds_format_integer(self.catagory, input_name='catagory'), namespace_, eol_)) + outfile.write('<catagory>%s</catagory>%s' % (self.gds_format_integer(self.catagory, input_name='catagory'), eol_)) def build(self, node): already_processed = set() self.buildAttributes(node, node.attrib, already_processed) diff --git a/tests/attr_groups1_sub.py b/tests/attr_groups1_sub.py index aaf81568bb95348f8e346c61a3cac766bdea7acd..1dbf96472d0a47248da0dfdfc5216399b2bdc689 100644 --- a/tests/attr_groups1_sub.py +++ b/tests/attr_groups1_sub.py @@ -2,7 +2,7 @@ # # Generated by generateDS.py. -# Python 2.7.13 (default, Jan 19 2017, 14:48:08) [GCC 6.3.0 20170118] +# Python 2.7.14 (default, Sep 23 2017, 22:06:14) [GCC 7.2.0] # # Command line options: # ('--no-dates', '') diff --git a/tests/attr_groups1_sup.py b/tests/attr_groups1_sup.py index 7afbdc73e2af83af4b8023d989de65c7df58899d..676f8c643c10860e3236def7fdff091fc05082b0 100644 --- a/tests/attr_groups1_sup.py +++ b/tests/attr_groups1_sup.py @@ -3,7 +3,7 @@ # # Generated by generateDS.py. -# Python 2.7.13 (default, Jan 19 2017, 14:48:08) [GCC 6.3.0 20170118] +# Python 2.7.14 (default, Sep 23 2017, 22:06:14) [GCC 7.2.0] # # Command line options: # ('--no-dates', '') @@ -831,7 +831,7 @@ class GetUserReq(GeneratedsSuper): eol_ = '' if self.returnedTags is not None: showIndent(outfile, level, pretty_print) - outfile.write('<%sreturnedTags>%s</%sreturnedTags>%s' % (namespace_, self.gds_encode(self.gds_format_string(quote_xml(self.returnedTags), input_name='returnedTags')), namespace_, eol_)) + outfile.write('<returnedTags>%s</returnedTags>%s' % (self.gds_encode(self.gds_format_string(quote_xml(self.returnedTags), input_name='returnedTags')), eol_)) def build(self, node): already_processed = set() self.buildAttributes(node, node.attrib, already_processed) diff --git a/tests/catalogtest1_sub.py b/tests/catalogtest1_sub.py index 4774abd39163dfde18280a3be6ae7c72bc28c67c..d72941cfec280f1f542a8f745f93c169a34b59de 100644 --- a/tests/catalogtest1_sub.py +++ b/tests/catalogtest1_sub.py @@ -2,7 +2,7 @@ # # Generated by generateDS.py. -# Python 2.7.13 (default, Jan 19 2017, 14:48:08) [GCC 6.3.0 20170118] +# Python 2.7.14 (default, Sep 23 2017, 22:06:14) [GCC 7.2.0] # # Command line options: # ('--no-dates', '') diff --git a/tests/catalogtest1_sup.py b/tests/catalogtest1_sup.py index b82c2b2b0322a617b36f4965df21aa431a9bf7cd..f0c9f3d82280ad54252ff659ba73d4fa9db19226 100644 --- a/tests/catalogtest1_sup.py +++ b/tests/catalogtest1_sup.py @@ -3,7 +3,7 @@ # # Generated by generateDS.py. -# Python 2.7.13 (default, Jan 19 2017, 14:48:08) [GCC 6.3.0 20170118] +# Python 2.7.14 (default, Sep 23 2017, 22:06:14) [GCC 7.2.0] # # Command line options: # ('--no-dates', '') diff --git a/tests/cdata1_sub.py b/tests/cdata1_sub.py index df6db6d4d8fa15e54bfd601f89b2edf0a446f28a..3e89c4cd38c0accae8b3ca8c5c052ed93d70f143 100644 --- a/tests/cdata1_sub.py +++ b/tests/cdata1_sub.py @@ -2,7 +2,7 @@ # # Generated by generateDS.py. -# Python 2.7.13 (default, Jan 19 2017, 14:48:08) [GCC 6.3.0 20170118] +# Python 2.7.14 (default, Sep 23 2017, 22:06:14) [GCC 7.2.0] # # Command line options: # ('--no-dates', '') diff --git a/tests/cdata1_sup.py b/tests/cdata1_sup.py index 0957622ab93d8579939d0fc5c4c50b757df0fd04..ce39ea62eb386f3efaaa6144401bd743576f85ec 100644 --- a/tests/cdata1_sup.py +++ b/tests/cdata1_sup.py @@ -3,7 +3,7 @@ # # Generated by generateDS.py. -# Python 2.7.13 (default, Jan 19 2017, 14:48:08) [GCC 6.3.0 20170118] +# Python 2.7.14 (default, Sep 23 2017, 22:06:14) [GCC 7.2.0] # # Command line options: # ('--no-dates', '') @@ -853,7 +853,7 @@ class cdataType(GeneratedsSuper): eol_ = '' if self.script is not None: showIndent(outfile, level, pretty_print) - outfile.write('<%sscript>%s</%sscript>%s' % (namespace_, self.gds_encode(self.gds_format_string(quote_xml(self.script), input_name='script')), namespace_, eol_)) + outfile.write('<script>%s</script>%s' % (self.gds_encode(self.gds_format_string(quote_xml(self.script), input_name='script')), eol_)) def build(self, node): already_processed = set() self.buildAttributes(node, node.attrib, already_processed) diff --git a/tests/cleanupname1_sub.py b/tests/cleanupname1_sub.py index d908e0dee6f7ae5922e52d68720e4d1d94281261..95b76556ebf8120ecdb592e9395388ef468ac712 100644 --- a/tests/cleanupname1_sub.py +++ b/tests/cleanupname1_sub.py @@ -2,7 +2,7 @@ # # Generated by generateDS.py. -# Python 2.7.13 (default, Jan 19 2017, 14:48:08) [GCC 6.3.0 20170118] +# Python 2.7.14 (default, Sep 23 2017, 22:06:14) [GCC 7.2.0] # # Command line options: # ('--no-dates', '') diff --git a/tests/cleanupname1_sup.py b/tests/cleanupname1_sup.py index b0a7c886f6645eb404e989abb1a38ceadaf09450..3d6c984c43bfc6f7704b24d52e3011f7ec690a26 100644 --- a/tests/cleanupname1_sup.py +++ b/tests/cleanupname1_sup.py @@ -3,7 +3,7 @@ # # Generated by generateDS.py. -# Python 2.7.13 (default, Jan 19 2017, 14:48:08) [GCC 6.3.0 20170118] +# Python 2.7.14 (default, Sep 23 2017, 22:06:14) [GCC 7.2.0] # # Command line options: # ('--no-dates', '') @@ -895,7 +895,7 @@ class data1Kind(GeneratedsSuper): eol_ = '' if self.content1 is not None: showIndent(outfile, level, pretty_print) - outfile.write('<%scontent1>%s</%scontent1>%s' % (namespace_, self.gds_encode(self.gds_format_string(quote_xml(self.content1), input_name='content1')), namespace_, eol_)) + outfile.write('<content1>%s</content1>%s' % (self.gds_encode(self.gds_format_string(quote_xml(self.content1), input_name='content1')), eol_)) def build(self, node): already_processed = set() self.buildAttributes(node, node.attrib, already_processed) @@ -972,7 +972,7 @@ class MlassData2(GeneratedsSuper): eol_ = '' if self.content1 is not None: showIndent(outfile, level, pretty_print) - outfile.write('<%scontent1>%s</%scontent1>%s' % (namespace_, self.gds_encode(self.gds_format_string(quote_xml(self.content1), input_name='content1')), namespace_, eol_)) + outfile.write('<content1>%s</content1>%s' % (self.gds_encode(self.gds_format_string(quote_xml(self.content1), input_name='content1')), eol_)) def build(self, node): already_processed = set() self.buildAttributes(node, node.attrib, already_processed) @@ -1049,7 +1049,7 @@ class RealTypeData3(GeneratedsSuper): eol_ = '' if self.content1 is not None: showIndent(outfile, level, pretty_print) - outfile.write('<%scontent1>%s</%scontent1>%s' % (namespace_, self.gds_encode(self.gds_format_string(quote_xml(self.content1), input_name='content1')), namespace_, eol_)) + outfile.write('<content1>%s</content1>%s' % (self.gds_encode(self.gds_format_string(quote_xml(self.content1), input_name='content1')), eol_)) def build(self, node): already_processed = set() self.buildAttributes(node, node.attrib, already_processed) @@ -1126,7 +1126,7 @@ class MMMMMMdataKind(GeneratedsSuper): eol_ = '' if self.content1 is not None: showIndent(outfile, level, pretty_print) - outfile.write('<%scontent1>%s</%scontent1>%s' % (namespace_, self.gds_encode(self.gds_format_string(quote_xml(self.content1), input_name='content1')), namespace_, eol_)) + outfile.write('<content1>%s</content1>%s' % (self.gds_encode(self.gds_format_string(quote_xml(self.content1), input_name='content1')), eol_)) def build(self, node): already_processed = set() self.buildAttributes(node, node.attrib, already_processed) @@ -1203,7 +1203,7 @@ class dataTypeNNNMNNN(GeneratedsSuper): eol_ = '' if self.content1 is not None: showIndent(outfile, level, pretty_print) - outfile.write('<%scontent1>%s</%scontent1>%s' % (namespace_, self.gds_encode(self.gds_format_string(quote_xml(self.content1), input_name='content1')), namespace_, eol_)) + outfile.write('<content1>%s</content1>%s' % (self.gds_encode(self.gds_format_string(quote_xml(self.content1), input_name='content1')), eol_)) def build(self, node): already_processed = set() self.buildAttributes(node, node.attrib, already_processed) diff --git a/tests/defaults_cases1_sub.py b/tests/defaults_cases1_sub.py index f3dfdcea67c59a563ceee80e51bcceea2fe25308..2e3a83a93422271d520edc71d12df0bff8a5f859 100644 --- a/tests/defaults_cases1_sub.py +++ b/tests/defaults_cases1_sub.py @@ -2,7 +2,7 @@ # # Generated by generateDS.py. -# Python 2.7.13 (default, Jan 19 2017, 14:48:08) [GCC 6.3.0 20170118] +# Python 2.7.14 (default, Sep 23 2017, 22:06:14) [GCC 7.2.0] # # Command line options: # ('--no-dates', '') diff --git a/tests/defaults_cases1_sup.py b/tests/defaults_cases1_sup.py index 98a3b4bba6ef7a727f225b0a10c9271e3dbc8b36..773a7a290397463c2e14ce47e663fc67f5e94514 100644 --- a/tests/defaults_cases1_sup.py +++ b/tests/defaults_cases1_sup.py @@ -3,7 +3,7 @@ # # Generated by generateDS.py. -# Python 2.7.13 (default, Jan 19 2017, 14:48:08) [GCC 6.3.0 20170118] +# Python 2.7.14 (default, Sep 23 2017, 22:06:14) [GCC 7.2.0] # # Command line options: # ('--no-dates', '') @@ -904,28 +904,28 @@ class DefaultType1(GeneratedsSuper): eol_ = '' if self.normal01 is not None: showIndent(outfile, level, pretty_print) - outfile.write('<%snormal01>%s</%snormal01>%s' % (namespace_, self.gds_format_integer(self.normal01, input_name='normal01'), namespace_, eol_)) + outfile.write('<normal01>%s</normal01>%s' % (self.gds_format_integer(self.normal01, input_name='normal01'), eol_)) if self.normal02 is not None: showIndent(outfile, level, pretty_print) - outfile.write('<%snormal02>%s</%snormal02>%s' % (namespace_, self.gds_encode(self.gds_format_string(quote_xml(self.normal02), input_name='normal02')), namespace_, eol_)) + outfile.write('<normal02>%s</normal02>%s' % (self.gds_encode(self.gds_format_string(quote_xml(self.normal02), input_name='normal02')), eol_)) if self.default01 != 23: showIndent(outfile, level, pretty_print) - outfile.write('<%sdefault01>%s</%sdefault01>%s' % (namespace_, self.gds_format_integer(self.default01, input_name='default01'), namespace_, eol_)) + outfile.write('<default01>%s</default01>%s' % (self.gds_format_integer(self.default01, input_name='default01'), eol_)) if self.default02 != "Peach": showIndent(outfile, level, pretty_print) - outfile.write('<%sdefault02>%s</%sdefault02>%s' % (namespace_, self.gds_encode(self.gds_format_string(quote_xml(self.default02), input_name='default02')), namespace_, eol_)) + outfile.write('<default02>%s</default02>%s' % (self.gds_encode(self.gds_format_string(quote_xml(self.default02), input_name='default02')), eol_)) if self.normal03 is not None: showIndent(outfile, level, pretty_print) - outfile.write('<%snormal03>%s</%snormal03>%s' % (namespace_, self.gds_format_float(self.normal03, input_name='normal03'), namespace_, eol_)) + outfile.write('<normal03>%s</normal03>%s' % (self.gds_format_float(self.normal03, input_name='normal03'), eol_)) if self.normal04 is not None: showIndent(outfile, level, pretty_print) - outfile.write('<%snormal04>%s</%snormal04>%s' % (namespace_, self.gds_format_double(self.normal04, input_name='normal04'), namespace_, eol_)) + outfile.write('<normal04>%s</normal04>%s' % (self.gds_format_double(self.normal04, input_name='normal04'), eol_)) if self.default03 != 23.45: showIndent(outfile, level, pretty_print) - outfile.write('<%sdefault03>%s</%sdefault03>%s' % (namespace_, self.gds_format_float(self.default03, input_name='default03'), namespace_, eol_)) + outfile.write('<default03>%s</default03>%s' % (self.gds_format_float(self.default03, input_name='default03'), eol_)) if self.default04 != 54.32: showIndent(outfile, level, pretty_print) - outfile.write('<%sdefault04>%s</%sdefault04>%s' % (namespace_, self.gds_format_double(self.default04, input_name='default04'), namespace_, eol_)) + outfile.write('<default04>%s</default04>%s' % (self.gds_format_double(self.default04, input_name='default04'), eol_)) def build(self, node): already_processed = set() self.buildAttributes(node, node.attrib, already_processed) diff --git a/tests/defaults_coverage1_sub.py b/tests/defaults_coverage1_sub.py index ed08d0deac2dbc0bc427eb5f2a12fb44297865a2..c1bdcc1b591c6d2e5aea8fff35812973cebf808c 100644 --- a/tests/defaults_coverage1_sub.py +++ b/tests/defaults_coverage1_sub.py @@ -2,7 +2,7 @@ # # Generated by generateDS.py. -# Python 2.7.13 (default, Jan 19 2017, 14:48:08) [GCC 6.3.0 20170118] +# Python 2.7.14 (default, Sep 23 2017, 22:06:14) [GCC 7.2.0] # # Command line options: # ('--no-dates', '') diff --git a/tests/defaults_coverage1_sup.py b/tests/defaults_coverage1_sup.py index 80defc275f2d5106c1145d6b6cde65f1642bc43b..2be5ec9fc6f4ba6a2cbd644366c860326b7a3bff 100644 --- a/tests/defaults_coverage1_sup.py +++ b/tests/defaults_coverage1_sup.py @@ -3,7 +3,7 @@ # # Generated by generateDS.py. -# Python 2.7.13 (default, Jan 19 2017, 14:48:08) [GCC 6.3.0 20170118] +# Python 2.7.14 (default, Sep 23 2017, 22:06:14) [GCC 7.2.0] # # Command line options: # ('--no-dates', '') @@ -962,55 +962,55 @@ class DefaultType1(GeneratedsSuper): eol_ = '' if self.default01 != 23: showIndent(outfile, level, pretty_print) - outfile.write('<%sdefault01>%s</%sdefault01>%s' % (namespace_, self.gds_format_integer(self.default01, input_name='default01'), namespace_, eol_)) + outfile.write('<default01>%s</default01>%s' % (self.gds_format_integer(self.default01, input_name='default01'), eol_)) if self.normal01 is not None: showIndent(outfile, level, pretty_print) - outfile.write('<%snormal01>%s</%snormal01>%s' % (namespace_, self.gds_format_integer(self.normal01, input_name='normal01'), namespace_, eol_)) + outfile.write('<normal01>%s</normal01>%s' % (self.gds_format_integer(self.normal01, input_name='normal01'), eol_)) if self.default02 != "Peach": showIndent(outfile, level, pretty_print) - outfile.write('<%sdefault02>%s</%sdefault02>%s' % (namespace_, self.gds_encode(self.gds_format_string(quote_xml(self.default02), input_name='default02')), namespace_, eol_)) + outfile.write('<default02>%s</default02>%s' % (self.gds_encode(self.gds_format_string(quote_xml(self.default02), input_name='default02')), eol_)) if self.normal02 is not None: showIndent(outfile, level, pretty_print) - outfile.write('<%snormal02>%s</%snormal02>%s' % (namespace_, self.gds_encode(self.gds_format_string(quote_xml(self.normal02), input_name='normal02')), namespace_, eol_)) + outfile.write('<normal02>%s</normal02>%s' % (self.gds_encode(self.gds_format_string(quote_xml(self.normal02), input_name='normal02')), eol_)) if self.default03 != 23.45: showIndent(outfile, level, pretty_print) - outfile.write('<%sdefault03>%s</%sdefault03>%s' % (namespace_, self.gds_format_float(self.default03, input_name='default03'), namespace_, eol_)) + outfile.write('<default03>%s</default03>%s' % (self.gds_format_float(self.default03, input_name='default03'), eol_)) if self.normal03 is not None: showIndent(outfile, level, pretty_print) - outfile.write('<%snormal03>%s</%snormal03>%s' % (namespace_, self.gds_format_float(self.normal03, input_name='normal03'), namespace_, eol_)) + outfile.write('<normal03>%s</normal03>%s' % (self.gds_format_float(self.normal03, input_name='normal03'), eol_)) if self.default04 != 54.32: showIndent(outfile, level, pretty_print) - outfile.write('<%sdefault04>%s</%sdefault04>%s' % (namespace_, self.gds_format_double(self.default04, input_name='default04'), namespace_, eol_)) + outfile.write('<default04>%s</default04>%s' % (self.gds_format_double(self.default04, input_name='default04'), eol_)) if self.normal04 is not None: showIndent(outfile, level, pretty_print) - outfile.write('<%snormal04>%s</%snormal04>%s' % (namespace_, self.gds_format_double(self.normal04, input_name='normal04'), namespace_, eol_)) + outfile.write('<normal04>%s</normal04>%s' % (self.gds_format_double(self.normal04, input_name='normal04'), eol_)) if not self.default05a: showIndent(outfile, level, pretty_print) - outfile.write('<%sdefault05a>%s</%sdefault05a>%s' % (namespace_, self.gds_format_boolean(self.default05a, input_name='default05a'), namespace_, eol_)) + outfile.write('<default05a>%s</default05a>%s' % (self.gds_format_boolean(self.default05a, input_name='default05a'), eol_)) if self.default05b: showIndent(outfile, level, pretty_print) - outfile.write('<%sdefault05b>%s</%sdefault05b>%s' % (namespace_, self.gds_format_boolean(self.default05b, input_name='default05b'), namespace_, eol_)) + outfile.write('<default05b>%s</default05b>%s' % (self.gds_format_boolean(self.default05b, input_name='default05b'), eol_)) if self.normal05 is not None: showIndent(outfile, level, pretty_print) - outfile.write('<%snormal05>%s</%snormal05>%s' % (namespace_, self.gds_format_boolean(self.normal05, input_name='normal05'), namespace_, eol_)) + outfile.write('<normal05>%s</normal05>%s' % (self.gds_format_boolean(self.normal05, input_name='normal05'), eol_)) if self.default06 != "2015-06-21": showIndent(outfile, level, pretty_print) - outfile.write('<%sdefault06>%s</%sdefault06>%s' % (namespace_, self.gds_format_date(self.default06, input_name='default06'), namespace_, eol_)) + outfile.write('<default06>%s</default06>%s' % (self.gds_format_date(self.default06, input_name='default06'), eol_)) if self.normal06 is not None: showIndent(outfile, level, pretty_print) - outfile.write('<%snormal06>%s</%snormal06>%s' % (namespace_, self.gds_format_date(self.normal06, input_name='normal06'), namespace_, eol_)) + outfile.write('<normal06>%s</normal06>%s' % (self.gds_format_date(self.normal06, input_name='normal06'), eol_)) if self.default07 != "11:10:09": showIndent(outfile, level, pretty_print) - outfile.write('<%sdefault07>%s</%sdefault07>%s' % (namespace_, self.gds_format_time(self.default07, input_name='default07'), namespace_, eol_)) + outfile.write('<default07>%s</default07>%s' % (self.gds_format_time(self.default07, input_name='default07'), eol_)) if self.normal07 is not None: showIndent(outfile, level, pretty_print) - outfile.write('<%snormal07>%s</%snormal07>%s' % (namespace_, self.gds_format_date(self.normal07, input_name='normal07'), namespace_, eol_)) + outfile.write('<normal07>%s</normal07>%s' % (self.gds_format_date(self.normal07, input_name='normal07'), eol_)) if self.default08 != "2015-06-21T14:13:12": showIndent(outfile, level, pretty_print) - outfile.write('<%sdefault08>%s</%sdefault08>%s' % (namespace_, self.gds_format_datetime(self.default08, input_name='default08'), namespace_, eol_)) + outfile.write('<default08>%s</default08>%s' % (self.gds_format_datetime(self.default08, input_name='default08'), eol_)) if self.normal08 is not None: showIndent(outfile, level, pretty_print) - outfile.write('<%snormal08>%s</%snormal08>%s' % (namespace_, self.gds_format_datetime(self.normal08, input_name='normal08'), namespace_, eol_)) + outfile.write('<normal08>%s</normal08>%s' % (self.gds_format_datetime(self.normal08, input_name='normal08'), eol_)) def build(self, node): already_processed = set() self.buildAttributes(node, node.attrib, already_processed) @@ -1297,55 +1297,55 @@ class DefaultType2(GeneratedsSuper): eol_ = '' if self.default01 != 23: showIndent(outfile, level, pretty_print) - outfile.write('<%sdefault01>%s</%sdefault01>%s' % (namespace_, self.gds_format_integer(self.default01, input_name='default01'), namespace_, eol_)) + outfile.write('<default01>%s</default01>%s' % (self.gds_format_integer(self.default01, input_name='default01'), eol_)) if self.normal01 is not None: showIndent(outfile, level, pretty_print) - outfile.write('<%snormal01>%s</%snormal01>%s' % (namespace_, self.gds_format_integer(self.normal01, input_name='normal01'), namespace_, eol_)) + outfile.write('<normal01>%s</normal01>%s' % (self.gds_format_integer(self.normal01, input_name='normal01'), eol_)) if self.default02 != "Peach": showIndent(outfile, level, pretty_print) - outfile.write('<%sdefault02>%s</%sdefault02>%s' % (namespace_, self.gds_encode(self.gds_format_string(quote_xml(self.default02), input_name='default02')), namespace_, eol_)) + outfile.write('<default02>%s</default02>%s' % (self.gds_encode(self.gds_format_string(quote_xml(self.default02), input_name='default02')), eol_)) if self.normal02 is not None: showIndent(outfile, level, pretty_print) - outfile.write('<%snormal02>%s</%snormal02>%s' % (namespace_, self.gds_encode(self.gds_format_string(quote_xml(self.normal02), input_name='normal02')), namespace_, eol_)) + outfile.write('<normal02>%s</normal02>%s' % (self.gds_encode(self.gds_format_string(quote_xml(self.normal02), input_name='normal02')), eol_)) if self.default03 != 23.45: showIndent(outfile, level, pretty_print) - outfile.write('<%sdefault03>%s</%sdefault03>%s' % (namespace_, self.gds_format_float(self.default03, input_name='default03'), namespace_, eol_)) + outfile.write('<default03>%s</default03>%s' % (self.gds_format_float(self.default03, input_name='default03'), eol_)) if self.normal03 is not None: showIndent(outfile, level, pretty_print) - outfile.write('<%snormal03>%s</%snormal03>%s' % (namespace_, self.gds_format_float(self.normal03, input_name='normal03'), namespace_, eol_)) + outfile.write('<normal03>%s</normal03>%s' % (self.gds_format_float(self.normal03, input_name='normal03'), eol_)) if self.default04 != 54.32: showIndent(outfile, level, pretty_print) - outfile.write('<%sdefault04>%s</%sdefault04>%s' % (namespace_, self.gds_format_double(self.default04, input_name='default04'), namespace_, eol_)) + outfile.write('<default04>%s</default04>%s' % (self.gds_format_double(self.default04, input_name='default04'), eol_)) if self.normal04 is not None: showIndent(outfile, level, pretty_print) - outfile.write('<%snormal04>%s</%snormal04>%s' % (namespace_, self.gds_format_double(self.normal04, input_name='normal04'), namespace_, eol_)) + outfile.write('<normal04>%s</normal04>%s' % (self.gds_format_double(self.normal04, input_name='normal04'), eol_)) if not self.default05a: showIndent(outfile, level, pretty_print) - outfile.write('<%sdefault05a>%s</%sdefault05a>%s' % (namespace_, self.gds_format_boolean(self.default05a, input_name='default05a'), namespace_, eol_)) + outfile.write('<default05a>%s</default05a>%s' % (self.gds_format_boolean(self.default05a, input_name='default05a'), eol_)) if self.default05b: showIndent(outfile, level, pretty_print) - outfile.write('<%sdefault05b>%s</%sdefault05b>%s' % (namespace_, self.gds_format_boolean(self.default05b, input_name='default05b'), namespace_, eol_)) + outfile.write('<default05b>%s</default05b>%s' % (self.gds_format_boolean(self.default05b, input_name='default05b'), eol_)) if self.normal05 is not None: showIndent(outfile, level, pretty_print) - outfile.write('<%snormal05>%s</%snormal05>%s' % (namespace_, self.gds_format_boolean(self.normal05, input_name='normal05'), namespace_, eol_)) + outfile.write('<normal05>%s</normal05>%s' % (self.gds_format_boolean(self.normal05, input_name='normal05'), eol_)) if self.default06 != "2015-06-21": showIndent(outfile, level, pretty_print) - outfile.write('<%sdefault06>%s</%sdefault06>%s' % (namespace_, self.gds_format_date(self.default06, input_name='default06'), namespace_, eol_)) + outfile.write('<default06>%s</default06>%s' % (self.gds_format_date(self.default06, input_name='default06'), eol_)) if self.normal06 is not None: showIndent(outfile, level, pretty_print) - outfile.write('<%snormal06>%s</%snormal06>%s' % (namespace_, self.gds_format_date(self.normal06, input_name='normal06'), namespace_, eol_)) + outfile.write('<normal06>%s</normal06>%s' % (self.gds_format_date(self.normal06, input_name='normal06'), eol_)) if self.default07 != "11:10:09": showIndent(outfile, level, pretty_print) - outfile.write('<%sdefault07>%s</%sdefault07>%s' % (namespace_, self.gds_format_time(self.default07, input_name='default07'), namespace_, eol_)) + outfile.write('<default07>%s</default07>%s' % (self.gds_format_time(self.default07, input_name='default07'), eol_)) if self.normal07 is not None: showIndent(outfile, level, pretty_print) - outfile.write('<%snormal07>%s</%snormal07>%s' % (namespace_, self.gds_format_date(self.normal07, input_name='normal07'), namespace_, eol_)) + outfile.write('<normal07>%s</normal07>%s' % (self.gds_format_date(self.normal07, input_name='normal07'), eol_)) if self.default08 != "2015-06-21T14:13:12": showIndent(outfile, level, pretty_print) - outfile.write('<%sdefault08>%s</%sdefault08>%s' % (namespace_, self.gds_format_datetime(self.default08, input_name='default08'), namespace_, eol_)) + outfile.write('<default08>%s</default08>%s' % (self.gds_format_datetime(self.default08, input_name='default08'), eol_)) if self.normal08 is not None: showIndent(outfile, level, pretty_print) - outfile.write('<%snormal08>%s</%snormal08>%s' % (namespace_, self.gds_format_datetime(self.normal08, input_name='normal08'), namespace_, eol_)) + outfile.write('<normal08>%s</normal08>%s' % (self.gds_format_datetime(self.normal08, input_name='normal08'), eol_)) def build(self, node): already_processed = set() self.buildAttributes(node, node.attrib, already_processed) diff --git a/tests/disable_xml_super1_sub.py b/tests/disable_xml_super1_sub.py index abac98f68293a366f3fedb8d9e7a878463c4e73c..21e7bdb455f0417a4eb4ec01c7337bf5146f1bbc 100644 --- a/tests/disable_xml_super1_sub.py +++ b/tests/disable_xml_super1_sub.py @@ -2,7 +2,7 @@ # # Generated by generateDS.py. -# Python 2.7.13 (default, Jan 19 2017, 14:48:08) [GCC 6.3.0 20170118] +# Python 2.7.14 (default, Sep 23 2017, 22:06:14) [GCC 7.2.0] # # Command line options: # ('--no-dates', '') diff --git a/tests/disable_xml_super1_sup.py b/tests/disable_xml_super1_sup.py index 867ad928a5905b39d9d2f9b66293ac7d11c1edbe..78be9fb9c96cfa9a6c237f2f0a8b6e9f0c928360 100644 --- a/tests/disable_xml_super1_sup.py +++ b/tests/disable_xml_super1_sup.py @@ -3,7 +3,7 @@ # # Generated by generateDS.py. -# Python 2.7.13 (default, Jan 19 2017, 14:48:08) [GCC 6.3.0 20170118] +# Python 2.7.14 (default, Sep 23 2017, 22:06:14) [GCC 7.2.0] # # Command line options: # ('--no-dates', '') diff --git a/tests/extensions1_sub.py b/tests/extensions1_sub.py index 52b0523c4b492c26e90b1292e56a7f13bd037ad7..5dd0b4725f7c6690a7b6636b3ad26a02ad7e2d58 100644 --- a/tests/extensions1_sub.py +++ b/tests/extensions1_sub.py @@ -2,7 +2,7 @@ # # Generated by generateDS.py. -# Python 2.7.13 (default, Jan 19 2017, 14:48:08) [GCC 6.3.0 20170118] +# Python 2.7.14 (default, Sep 23 2017, 22:06:14) [GCC 7.2.0] # # Command line options: # ('--no-dates', '') diff --git a/tests/extensions1_sup.py b/tests/extensions1_sup.py index c4f8c48f1127c76793411584e85768cac340ed54..efd5c319d3062316a7e78c3c406acf2b6776798c 100644 --- a/tests/extensions1_sup.py +++ b/tests/extensions1_sup.py @@ -3,7 +3,7 @@ # # Generated by generateDS.py. -# Python 2.7.13 (default, Jan 19 2017, 14:48:08) [GCC 6.3.0 20170118] +# Python 2.7.14 (default, Sep 23 2017, 22:06:14) [GCC 7.2.0] # # Command line options: # ('--no-dates', '') @@ -1129,7 +1129,7 @@ class simpleFactoidType(GeneratedsSuper): eol_ = '' if self.relation is not None: showIndent(outfile, level, pretty_print) - outfile.write('<%srelation>%s</%srelation>%s' % (namespace_, self.gds_encode(self.gds_format_string(quote_xml(self.relation), input_name='relation')), namespace_, eol_)) + outfile.write('<relation>%s</relation>%s' % (self.gds_encode(self.gds_format_string(quote_xml(self.relation), input_name='relation')), eol_)) def build(self, node): already_processed = set() self.buildAttributes(node, node.attrib, already_processed) @@ -1256,7 +1256,7 @@ class mixedFactoidType(GeneratedsSuper): eol_ = '' if self.relation is not None: showIndent(outfile, level, pretty_print) - outfile.write('<%srelation>%s</%srelation>%s' % (namespace_, self.gds_encode(self.gds_format_string(quote_xml(self.relation), input_name='relation')), namespace_, eol_)) + outfile.write('<relation>%s</relation>%s' % (self.gds_encode(self.gds_format_string(quote_xml(self.relation), input_name='relation')), eol_)) def build(self, node): already_processed = set() self.buildAttributes(node, node.attrib, already_processed) diff --git a/tests/ipo1_sub.py b/tests/ipo1_sub.py index 425e9e16e0828267e9b847261575f32753af55ea..3205173f3800778df6c9f2f46e75e376ce997315 100644 --- a/tests/ipo1_sub.py +++ b/tests/ipo1_sub.py @@ -2,7 +2,7 @@ # # Generated by generateDS.py. -# Python 2.7.13 (default, Jan 19 2017, 14:48:08) [GCC 6.3.0 20170118] +# Python 2.7.14 (default, Sep 23 2017, 22:06:14) [GCC 7.2.0] # # Command line options: # ('--no-dates', '') diff --git a/tests/ipo1_sup.py b/tests/ipo1_sup.py index 2a1363a5cbb1976b68594678f9637d0606221128..c1c929adb6debd2130f543f8d307161c0ac990f7 100644 --- a/tests/ipo1_sup.py +++ b/tests/ipo1_sup.py @@ -3,7 +3,7 @@ # # Generated by generateDS.py. -# Python 2.7.13 (default, Jan 19 2017, 14:48:08) [GCC 6.3.0 20170118] +# Python 2.7.14 (default, Sep 23 2017, 22:06:14) [GCC 7.2.0] # # Command line options: # ('--no-dates', '') @@ -797,7 +797,7 @@ class PurchaseOrderType(GeneratedsSuper): self.billTo.export(outfile, level, namespace_, name_='billTo', pretty_print=pretty_print) if self.comment is not None: showIndent(outfile, level, pretty_print) - outfile.write('<%scomment>%s</%scomment>%s' % (namespace_, self.gds_encode(self.gds_format_string(quote_xml(self.comment), input_name='comment')), namespace_, eol_)) + outfile.write('<ipo:comment>%s</ipo:comment>%s' % (self.gds_encode(self.gds_format_string(quote_xml(self.comment), input_name='comment')), eol_)) if self.items is not None: self.items.export(outfile, level, namespace_, name_='items', pretty_print=pretty_print) def build(self, node): @@ -1012,19 +1012,19 @@ class item(GeneratedsSuper): eol_ = '' if self.productName is not None: showIndent(outfile, level, pretty_print) - outfile.write('<%sproductName>%s</%sproductName>%s' % (namespace_, self.gds_encode(self.gds_format_string(quote_xml(self.productName), input_name='productName')), namespace_, eol_)) + outfile.write('<ipo:productName>%s</ipo:productName>%s' % (self.gds_encode(self.gds_format_string(quote_xml(self.productName), input_name='productName')), eol_)) if self.quantity is not None: showIndent(outfile, level, pretty_print) - outfile.write('<%squantity>%s</%squantity>%s' % (namespace_, self.gds_format_integer(self.quantity, input_name='quantity'), namespace_, eol_)) + outfile.write('<ipo:quantity>%s</ipo:quantity>%s' % (self.gds_format_integer(self.quantity, input_name='quantity'), eol_)) if self.USPrice is not None: showIndent(outfile, level, pretty_print) - outfile.write('<%sUSPrice>%s</%sUSPrice>%s' % (namespace_, self.gds_format_float(self.USPrice, input_name='USPrice'), namespace_, eol_)) + outfile.write('<ipo:USPrice>%s</ipo:USPrice>%s' % (self.gds_format_float(self.USPrice, input_name='USPrice'), eol_)) if self.comment is not None: showIndent(outfile, level, pretty_print) - outfile.write('<%scomment>%s</%scomment>%s' % (namespace_, self.gds_encode(self.gds_format_string(quote_xml(self.comment), input_name='comment')), namespace_, eol_)) + outfile.write('<ipo:comment>%s</ipo:comment>%s' % (self.gds_encode(self.gds_format_string(quote_xml(self.comment), input_name='comment')), eol_)) if self.shipDate is not None: showIndent(outfile, level, pretty_print) - outfile.write('<%sshipDate>%s</%sshipDate>%s' % (namespace_, self.gds_format_date(self.shipDate, input_name='shipDate'), namespace_, eol_)) + outfile.write('<ipo:shipDate>%s</ipo:shipDate>%s' % (self.gds_format_date(self.shipDate, input_name='shipDate'), eol_)) def build(self, node): already_processed = set() self.buildAttributes(node, node.attrib, already_processed) @@ -1211,13 +1211,13 @@ class Address(GeneratedsSuper): eol_ = '' if self.name is not None: showIndent(outfile, level, pretty_print) - outfile.write('<%sname>%s</%sname>%s' % (namespace_, self.gds_encode(self.gds_format_string(quote_xml(self.name), input_name='name')), namespace_, eol_)) + outfile.write('<ipo:name>%s</ipo:name>%s' % (self.gds_encode(self.gds_format_string(quote_xml(self.name), input_name='name')), eol_)) if self.street is not None: showIndent(outfile, level, pretty_print) - outfile.write('<%sstreet>%s</%sstreet>%s' % (namespace_, self.gds_encode(self.gds_format_string(quote_xml(self.street), input_name='street')), namespace_, eol_)) + outfile.write('<ipo:street>%s</ipo:street>%s' % (self.gds_encode(self.gds_format_string(quote_xml(self.street), input_name='street')), eol_)) if self.city is not None: showIndent(outfile, level, pretty_print) - outfile.write('<%scity>%s</%scity>%s' % (namespace_, self.gds_encode(self.gds_format_string(quote_xml(self.city), input_name='city')), namespace_, eol_)) + outfile.write('<ipo:city>%s</ipo:city>%s' % (self.gds_encode(self.gds_format_string(quote_xml(self.city), input_name='city')), eol_)) def build(self, node): already_processed = set() self.buildAttributes(node, node.attrib, already_processed) @@ -1326,10 +1326,10 @@ class USAddress(Address): eol_ = '' if self.state is not None: showIndent(outfile, level, pretty_print) - outfile.write('<%sstate>%s</%sstate>%s' % (namespace_, self.gds_encode(self.gds_format_string(quote_xml(self.state), input_name='state')), namespace_, eol_)) + outfile.write('<ipo:state>%s</ipo:state>%s' % (self.gds_encode(self.gds_format_string(quote_xml(self.state), input_name='state')), eol_)) if self.zip is not None: showIndent(outfile, level, pretty_print) - outfile.write('<%szip>%s</%szip>%s' % (namespace_, self.gds_format_integer(self.zip, input_name='zip'), namespace_, eol_)) + outfile.write('<ipo:zip>%s</ipo:zip>%s' % (self.gds_format_integer(self.zip, input_name='zip'), eol_)) def build(self, node): already_processed = set() self.buildAttributes(node, node.attrib, already_processed) @@ -1429,7 +1429,7 @@ class UKAddress(Address): eol_ = '' if self.postcode is not None: showIndent(outfile, level, pretty_print) - outfile.write('<%spostcode>%s</%spostcode>%s' % (namespace_, self.gds_encode(self.gds_format_string(quote_xml(self.postcode), input_name='postcode')), namespace_, eol_)) + outfile.write('<ipo:postcode>%s</ipo:postcode>%s' % (self.gds_encode(self.gds_format_string(quote_xml(self.postcode), input_name='postcode')), eol_)) def build(self, node): already_processed = set() self.buildAttributes(node, node.attrib, already_processed) diff --git a/tests/ipo2_sub.py b/tests/ipo2_sub.py index 425e9e16e0828267e9b847261575f32753af55ea..3205173f3800778df6c9f2f46e75e376ce997315 100644 --- a/tests/ipo2_sub.py +++ b/tests/ipo2_sub.py @@ -2,7 +2,7 @@ # # Generated by generateDS.py. -# Python 2.7.13 (default, Jan 19 2017, 14:48:08) [GCC 6.3.0 20170118] +# Python 2.7.14 (default, Sep 23 2017, 22:06:14) [GCC 7.2.0] # # Command line options: # ('--no-dates', '') diff --git a/tests/ipo2_sup.py b/tests/ipo2_sup.py index 2a1363a5cbb1976b68594678f9637d0606221128..c1c929adb6debd2130f543f8d307161c0ac990f7 100644 --- a/tests/ipo2_sup.py +++ b/tests/ipo2_sup.py @@ -3,7 +3,7 @@ # # Generated by generateDS.py. -# Python 2.7.13 (default, Jan 19 2017, 14:48:08) [GCC 6.3.0 20170118] +# Python 2.7.14 (default, Sep 23 2017, 22:06:14) [GCC 7.2.0] # # Command line options: # ('--no-dates', '') @@ -797,7 +797,7 @@ class PurchaseOrderType(GeneratedsSuper): self.billTo.export(outfile, level, namespace_, name_='billTo', pretty_print=pretty_print) if self.comment is not None: showIndent(outfile, level, pretty_print) - outfile.write('<%scomment>%s</%scomment>%s' % (namespace_, self.gds_encode(self.gds_format_string(quote_xml(self.comment), input_name='comment')), namespace_, eol_)) + outfile.write('<ipo:comment>%s</ipo:comment>%s' % (self.gds_encode(self.gds_format_string(quote_xml(self.comment), input_name='comment')), eol_)) if self.items is not None: self.items.export(outfile, level, namespace_, name_='items', pretty_print=pretty_print) def build(self, node): @@ -1012,19 +1012,19 @@ class item(GeneratedsSuper): eol_ = '' if self.productName is not None: showIndent(outfile, level, pretty_print) - outfile.write('<%sproductName>%s</%sproductName>%s' % (namespace_, self.gds_encode(self.gds_format_string(quote_xml(self.productName), input_name='productName')), namespace_, eol_)) + outfile.write('<ipo:productName>%s</ipo:productName>%s' % (self.gds_encode(self.gds_format_string(quote_xml(self.productName), input_name='productName')), eol_)) if self.quantity is not None: showIndent(outfile, level, pretty_print) - outfile.write('<%squantity>%s</%squantity>%s' % (namespace_, self.gds_format_integer(self.quantity, input_name='quantity'), namespace_, eol_)) + outfile.write('<ipo:quantity>%s</ipo:quantity>%s' % (self.gds_format_integer(self.quantity, input_name='quantity'), eol_)) if self.USPrice is not None: showIndent(outfile, level, pretty_print) - outfile.write('<%sUSPrice>%s</%sUSPrice>%s' % (namespace_, self.gds_format_float(self.USPrice, input_name='USPrice'), namespace_, eol_)) + outfile.write('<ipo:USPrice>%s</ipo:USPrice>%s' % (self.gds_format_float(self.USPrice, input_name='USPrice'), eol_)) if self.comment is not None: showIndent(outfile, level, pretty_print) - outfile.write('<%scomment>%s</%scomment>%s' % (namespace_, self.gds_encode(self.gds_format_string(quote_xml(self.comment), input_name='comment')), namespace_, eol_)) + outfile.write('<ipo:comment>%s</ipo:comment>%s' % (self.gds_encode(self.gds_format_string(quote_xml(self.comment), input_name='comment')), eol_)) if self.shipDate is not None: showIndent(outfile, level, pretty_print) - outfile.write('<%sshipDate>%s</%sshipDate>%s' % (namespace_, self.gds_format_date(self.shipDate, input_name='shipDate'), namespace_, eol_)) + outfile.write('<ipo:shipDate>%s</ipo:shipDate>%s' % (self.gds_format_date(self.shipDate, input_name='shipDate'), eol_)) def build(self, node): already_processed = set() self.buildAttributes(node, node.attrib, already_processed) @@ -1211,13 +1211,13 @@ class Address(GeneratedsSuper): eol_ = '' if self.name is not None: showIndent(outfile, level, pretty_print) - outfile.write('<%sname>%s</%sname>%s' % (namespace_, self.gds_encode(self.gds_format_string(quote_xml(self.name), input_name='name')), namespace_, eol_)) + outfile.write('<ipo:name>%s</ipo:name>%s' % (self.gds_encode(self.gds_format_string(quote_xml(self.name), input_name='name')), eol_)) if self.street is not None: showIndent(outfile, level, pretty_print) - outfile.write('<%sstreet>%s</%sstreet>%s' % (namespace_, self.gds_encode(self.gds_format_string(quote_xml(self.street), input_name='street')), namespace_, eol_)) + outfile.write('<ipo:street>%s</ipo:street>%s' % (self.gds_encode(self.gds_format_string(quote_xml(self.street), input_name='street')), eol_)) if self.city is not None: showIndent(outfile, level, pretty_print) - outfile.write('<%scity>%s</%scity>%s' % (namespace_, self.gds_encode(self.gds_format_string(quote_xml(self.city), input_name='city')), namespace_, eol_)) + outfile.write('<ipo:city>%s</ipo:city>%s' % (self.gds_encode(self.gds_format_string(quote_xml(self.city), input_name='city')), eol_)) def build(self, node): already_processed = set() self.buildAttributes(node, node.attrib, already_processed) @@ -1326,10 +1326,10 @@ class USAddress(Address): eol_ = '' if self.state is not None: showIndent(outfile, level, pretty_print) - outfile.write('<%sstate>%s</%sstate>%s' % (namespace_, self.gds_encode(self.gds_format_string(quote_xml(self.state), input_name='state')), namespace_, eol_)) + outfile.write('<ipo:state>%s</ipo:state>%s' % (self.gds_encode(self.gds_format_string(quote_xml(self.state), input_name='state')), eol_)) if self.zip is not None: showIndent(outfile, level, pretty_print) - outfile.write('<%szip>%s</%szip>%s' % (namespace_, self.gds_format_integer(self.zip, input_name='zip'), namespace_, eol_)) + outfile.write('<ipo:zip>%s</ipo:zip>%s' % (self.gds_format_integer(self.zip, input_name='zip'), eol_)) def build(self, node): already_processed = set() self.buildAttributes(node, node.attrib, already_processed) @@ -1429,7 +1429,7 @@ class UKAddress(Address): eol_ = '' if self.postcode is not None: showIndent(outfile, level, pretty_print) - outfile.write('<%spostcode>%s</%spostcode>%s' % (namespace_, self.gds_encode(self.gds_format_string(quote_xml(self.postcode), input_name='postcode')), namespace_, eol_)) + outfile.write('<ipo:postcode>%s</ipo:postcode>%s' % (self.gds_encode(self.gds_format_string(quote_xml(self.postcode), input_name='postcode')), eol_)) def build(self, node): already_processed = set() self.buildAttributes(node, node.attrib, already_processed) diff --git a/tests/mapcleanname1_sub.py b/tests/mapcleanname1_sub.py index 88bbf3c0b3b61e7bc8dc959861fb77a151e84fe6..faf1c0392c4992cfd3b34916aead5f84d44f3762 100644 --- a/tests/mapcleanname1_sub.py +++ b/tests/mapcleanname1_sub.py @@ -2,7 +2,7 @@ # # Generated by generateDS.py. -# Python 2.7.13 (default, Jan 19 2017, 14:48:08) [GCC 6.3.0 20170118] +# Python 2.7.14 (default, Sep 23 2017, 22:06:14) [GCC 7.2.0] # # Command line options: # ('--no-dates', '') diff --git a/tests/mapcleanname1_sup.py b/tests/mapcleanname1_sup.py index 5ff85364b34454ceff49acc96f5887dbe2e8833e..711180efc8a1004e3e17df066ce6477a1e476da1 100644 --- a/tests/mapcleanname1_sup.py +++ b/tests/mapcleanname1_sup.py @@ -3,7 +3,7 @@ # # Generated by generateDS.py. -# Python 2.7.13 (default, Jan 19 2017, 14:48:08) [GCC 6.3.0 20170118] +# Python 2.7.14 (default, Sep 23 2017, 22:06:14) [GCC 7.2.0] # # Command line options: # ('--no-dates', '') @@ -790,13 +790,13 @@ class complex_type01(GeneratedsSuper): eol_ = '' if self.string_value01 is not None: showIndent(outfile, level, pretty_print) - outfile.write('<%sstring_value01>%s</%sstring_value01>%s' % (namespace_, self.gds_encode(self.gds_format_string(quote_xml(self.string_value01), input_name='string_value01')), namespace_, eol_)) + outfile.write('<string_value01>%s</string_value01>%s' % (self.gds_encode(self.gds_format_string(quote_xml(self.string_value01), input_name='string_value01')), eol_)) for integer_value01_ in self.integer_value01: showIndent(outfile, level, pretty_print) - outfile.write('<%sinteger_value01>%s</%sinteger_value01>%s' % (namespace_, self.gds_format_integer(integer_value01_, input_name='integer_value01'), namespace_, eol_)) + outfile.write('<integer_value01>%s</integer_value01>%s' % (self.gds_format_integer(integer_value01_, input_name='integer_value01'), eol_)) if self.float_value01 is not None: showIndent(outfile, level, pretty_print) - outfile.write('<%sfloat_value01>%s</%sfloat_value01>%s' % (namespace_, self.gds_format_float(self.float_value01, input_name='float_value01'), namespace_, eol_)) + outfile.write('<float_value01>%s</float_value01>%s' % (self.gds_format_float(self.float_value01, input_name='float_value01'), eol_)) if self.field01 is not None: self.field01.export(outfile, level, namespace_, name_='field01', pretty_print=pretty_print) def build(self, node): @@ -919,13 +919,13 @@ class complex_type02(GeneratedsSuper): eol_ = '' if self.string_value02 is not None: showIndent(outfile, level, pretty_print) - outfile.write('<%sstring_value02>%s</%sstring_value02>%s' % (namespace_, self.gds_encode(self.gds_format_string(quote_xml(self.string_value02), input_name='string_value02')), namespace_, eol_)) + outfile.write('<string_value02>%s</string_value02>%s' % (self.gds_encode(self.gds_format_string(quote_xml(self.string_value02), input_name='string_value02')), eol_)) for integer_value02_ in self.integer_value02: showIndent(outfile, level, pretty_print) - outfile.write('<%sinteger_value02>%s</%sinteger_value02>%s' % (namespace_, self.gds_format_integer(integer_value02_, input_name='integer_value02'), namespace_, eol_)) + outfile.write('<integer_value02>%s</integer_value02>%s' % (self.gds_format_integer(integer_value02_, input_name='integer_value02'), eol_)) if self.float_value02 is not None: showIndent(outfile, level, pretty_print) - outfile.write('<%sfloat_value02>%s</%sfloat_value02>%s' % (namespace_, self.gds_format_float(self.float_value02, input_name='float_value02'), namespace_, eol_)) + outfile.write('<float_value02>%s</float_value02>%s' % (self.gds_format_float(self.float_value02, input_name='float_value02'), eol_)) def build(self, node): already_processed = set() self.buildAttributes(node, node.attrib, already_processed) @@ -1040,13 +1040,13 @@ class complex_type03(complex_type02): eol_ = '' if self.string_value03 is not None: showIndent(outfile, level, pretty_print) - outfile.write('<%sstring_value03>%s</%sstring_value03>%s' % (namespace_, self.gds_encode(self.gds_format_string(quote_xml(self.string_value03), input_name='string_value03')), namespace_, eol_)) + outfile.write('<string_value03>%s</string_value03>%s' % (self.gds_encode(self.gds_format_string(quote_xml(self.string_value03), input_name='string_value03')), eol_)) for integer_value03_ in self.integer_value03: showIndent(outfile, level, pretty_print) - outfile.write('<%sinteger_value03>%s</%sinteger_value03>%s' % (namespace_, self.gds_format_integer(integer_value03_, input_name='integer_value03'), namespace_, eol_)) + outfile.write('<integer_value03>%s</integer_value03>%s' % (self.gds_format_integer(integer_value03_, input_name='integer_value03'), eol_)) if self.float_value03 is not None: showIndent(outfile, level, pretty_print) - outfile.write('<%sfloat_value03>%s</%sfloat_value03>%s' % (namespace_, self.gds_format_float(self.float_value03, input_name='float_value03'), namespace_, eol_)) + outfile.write('<float_value03>%s</float_value03>%s' % (self.gds_format_float(self.float_value03, input_name='float_value03'), eol_)) def build(self, node): already_processed = set() self.buildAttributes(node, node.attrib, already_processed) @@ -1163,13 +1163,13 @@ class type_(GeneratedsSuper): eol_ = '' if self.string_value02 is not None: showIndent(outfile, level, pretty_print) - outfile.write('<%sstring_value02>%s</%sstring_value02>%s' % (namespace_, self.gds_encode(self.gds_format_string(quote_xml(self.string_value02), input_name='string_value02')), namespace_, eol_)) + outfile.write('<string_value02>%s</string_value02>%s' % (self.gds_encode(self.gds_format_string(quote_xml(self.string_value02), input_name='string_value02')), eol_)) for integer_value02_ in self.integer_value02: showIndent(outfile, level, pretty_print) - outfile.write('<%sinteger_value02>%s</%sinteger_value02>%s' % (namespace_, self.gds_format_integer(integer_value02_, input_name='integer_value02'), namespace_, eol_)) + outfile.write('<integer_value02>%s</integer_value02>%s' % (self.gds_format_integer(integer_value02_, input_name='integer_value02'), eol_)) if self.float_value02 is not None: showIndent(outfile, level, pretty_print) - outfile.write('<%sfloat_value02>%s</%sfloat_value02>%s' % (namespace_, self.gds_format_float(self.float_value02, input_name='float_value02'), namespace_, eol_)) + outfile.write('<float_value02>%s</float_value02>%s' % (self.gds_format_float(self.float_value02, input_name='float_value02'), eol_)) def build(self, node): already_processed = set() self.buildAttributes(node, node.attrib, already_processed) @@ -1284,13 +1284,13 @@ class complex_type04(type_): eol_ = '' if self.string_value03 is not None: showIndent(outfile, level, pretty_print) - outfile.write('<%sstring_value03>%s</%sstring_value03>%s' % (namespace_, self.gds_encode(self.gds_format_string(quote_xml(self.string_value03), input_name='string_value03')), namespace_, eol_)) + outfile.write('<string_value03>%s</string_value03>%s' % (self.gds_encode(self.gds_format_string(quote_xml(self.string_value03), input_name='string_value03')), eol_)) for integer_value03_ in self.integer_value03: showIndent(outfile, level, pretty_print) - outfile.write('<%sinteger_value03>%s</%sinteger_value03>%s' % (namespace_, self.gds_format_integer(integer_value03_, input_name='integer_value03'), namespace_, eol_)) + outfile.write('<integer_value03>%s</integer_value03>%s' % (self.gds_format_integer(integer_value03_, input_name='integer_value03'), eol_)) if self.float_value03 is not None: showIndent(outfile, level, pretty_print) - outfile.write('<%sfloat_value03>%s</%sfloat_value03>%s' % (namespace_, self.gds_format_float(self.float_value03, input_name='float_value03'), namespace_, eol_)) + outfile.write('<float_value03>%s</float_value03>%s' % (self.gds_format_float(self.float_value03, input_name='float_value03'), eol_)) def build(self, node): already_processed = set() self.buildAttributes(node, node.attrib, already_processed) @@ -1407,13 +1407,13 @@ class build_(GeneratedsSuper): eol_ = '' if self.string_value02 is not None: showIndent(outfile, level, pretty_print) - outfile.write('<%sstring_value02>%s</%sstring_value02>%s' % (namespace_, self.gds_encode(self.gds_format_string(quote_xml(self.string_value02), input_name='string_value02')), namespace_, eol_)) + outfile.write('<string_value02>%s</string_value02>%s' % (self.gds_encode(self.gds_format_string(quote_xml(self.string_value02), input_name='string_value02')), eol_)) for integer_value02_ in self.integer_value02: showIndent(outfile, level, pretty_print) - outfile.write('<%sinteger_value02>%s</%sinteger_value02>%s' % (namespace_, self.gds_format_integer(integer_value02_, input_name='integer_value02'), namespace_, eol_)) + outfile.write('<integer_value02>%s</integer_value02>%s' % (self.gds_format_integer(integer_value02_, input_name='integer_value02'), eol_)) if self.float_value02 is not None: showIndent(outfile, level, pretty_print) - outfile.write('<%sfloat_value02>%s</%sfloat_value02>%s' % (namespace_, self.gds_format_float(self.float_value02, input_name='float_value02'), namespace_, eol_)) + outfile.write('<float_value02>%s</float_value02>%s' % (self.gds_format_float(self.float_value02, input_name='float_value02'), eol_)) def build(self, node): already_processed = set() self.buildAttributes(node, node.attrib, already_processed) @@ -1528,13 +1528,13 @@ class complex_type05(build_): eol_ = '' if self.string_value03 is not None: showIndent(outfile, level, pretty_print) - outfile.write('<%sstring_value03>%s</%sstring_value03>%s' % (namespace_, self.gds_encode(self.gds_format_string(quote_xml(self.string_value03), input_name='string_value03')), namespace_, eol_)) + outfile.write('<string_value03>%s</string_value03>%s' % (self.gds_encode(self.gds_format_string(quote_xml(self.string_value03), input_name='string_value03')), eol_)) for integer_value03_ in self.integer_value03: showIndent(outfile, level, pretty_print) - outfile.write('<%sinteger_value03>%s</%sinteger_value03>%s' % (namespace_, self.gds_format_integer(integer_value03_, input_name='integer_value03'), namespace_, eol_)) + outfile.write('<integer_value03>%s</integer_value03>%s' % (self.gds_format_integer(integer_value03_, input_name='integer_value03'), eol_)) if self.float_value03 is not None: showIndent(outfile, level, pretty_print) - outfile.write('<%sfloat_value03>%s</%sfloat_value03>%s' % (namespace_, self.gds_format_float(self.float_value03, input_name='float_value03'), namespace_, eol_)) + outfile.write('<float_value03>%s</float_value03>%s' % (self.gds_format_float(self.float_value03, input_name='float_value03'), eol_)) def build(self, node): already_processed = set() self.buildAttributes(node, node.attrib, already_processed) diff --git a/tests/mixedcontent.xml b/tests/mixedcontent.xml new file mode 100644 index 0000000000000000000000000000000000000000..2faadbfbf3197981aea935fa45143a3e5a3281ae --- /dev/null +++ b/tests/mixedcontent.xml @@ -0,0 +1,27 @@ +<?xml version="1.0" encoding="UTF-8"?> +<root> + <markup>This markup has <embedded>content</embedded> within it.</markup> + <markup>This markup has element + <nested> + <nested1> + <nestedA1> + <nestedB1>B1 text A</nestedB1> + <nestedB2>B2 text A</nestedB2> + </nestedA1> + <nestedA1> + <nestedB1>B1 text B</nestedB1> + <nestedB2>B2 text B</nestedB2> + </nestedA1> + </nested1> + <nested2>Some nested text</nested2> + <nested3>1234</nested3> + </nested> + content and character content + <nested> + <nested2>Some nested text</nested2> + <nested3>1234</nested3> + </nested> + within it. + </markup> +</root> + diff --git a/tests/mixedcontent.xsd b/tests/mixedcontent.xsd new file mode 100644 index 0000000000000000000000000000000000000000..cf85b1888cb10af3947aa74e2b4158d18b5d01d9 --- /dev/null +++ b/tests/mixedcontent.xsd @@ -0,0 +1,56 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- edited with XMLSpy v2007 rel. 3 (http://www.altova.com) by Erwin de Kock (Philips Electronics Nederland BV) --> +<!-- + Tests for mixed="True" + --> +<xs:schema + xmlns:xs="http://www.w3.org/2001/XMLSchema" + > + + <xs:element name="root" type="rootType"/> + <xs:complexType name="rootType"> + <xs:sequence> + <xs:element name="markup" type="markupType" + maxOccurs="unbounded"/> + </xs:sequence> + </xs:complexType> + + <xs:complexType name="markupType" mixed="true"> + <xs:sequence> + <xs:element name="embedded" type="xs:string" + minOccurs="0" maxOccurs="unbounded"/> + <xs:element name="nested" type="nestedType" + minOccurs="0" maxOccurs="unbounded"/> + </xs:sequence> + </xs:complexType> + + <xs:complexType name="nestedType"> + <xs:sequence> + <xs:element name="nested1" type="nested1Type" + minOccurs="0" maxOccurs="unbounded"/> + <xs:element name="nested2" type="xs:string" + minOccurs="0" maxOccurs="unbounded"/> + <xs:element name="nested3" type="xs:integer" + minOccurs="0" maxOccurs="unbounded"/> + </xs:sequence> + </xs:complexType> + + <xs:complexType name="nested1Type"> + <xs:sequence> + <xs:element name="nestedA1" type="nested1AType" + minOccurs="0" maxOccurs="unbounded"/> + <xs:element name="nestedA2" type="nested1AType" + minOccurs="0" maxOccurs="unbounded"/> + </xs:sequence> + </xs:complexType> + + <xs:complexType name="nested1AType"> + <xs:sequence> + <xs:element name="nestedB1" type="xs:string" + maxOccurs="unbounded"/> + <xs:element name="nestedB2" type="xs:string" + maxOccurs="unbounded"/> + </xs:sequence> + </xs:complexType> + +</xs:schema> diff --git a/tests/mixedcontent1_out.xml b/tests/mixedcontent1_out.xml new file mode 100644 index 0000000000000000000000000000000000000000..844a60c5302dfc9aac29d7a8688888c49f4aea10 --- /dev/null +++ b/tests/mixedcontent1_out.xml @@ -0,0 +1,48 @@ +<?xml version="1.0" ?> +<root> + <markup> +This markup has <embedded>content</embedded> within it. </markup> + <markup> +This markup has element + <nested> + <nested1> + <nestedA1> + <nestedB1>B1 text A</nestedB1> + <nestedB2>B2 text A</nestedB2> + </nestedA1> + <nestedA1> + <nestedB1>B1 text B</nestedB1> + <nestedB2>B2 text B</nestedB2> + </nestedA1> + </nested1> + <nested2>Some nested text</nested2> + <nested3>1234</nested3> + </nested> + + content and character content + <nested> + <nested2>Some nested text</nested2> + <nested3>1234</nested3> + </nested> + + within it. + <nested> + <nested1> + <nestedA1> + <nestedB1>B1 text A</nestedB1> + <nestedB2>B2 text A</nestedB2> + </nestedA1> + <nestedA1> + <nestedB1>B1 text B</nestedB1> + <nestedB2>B2 text B</nestedB2> + </nestedA1> + </nested1> + <nested2>Some nested text</nested2> + <nested3>1234</nested3> + </nested> + <nested> + <nested2>Some nested text</nested2> + <nested3>1234</nested3> + </nested> + </markup> +</root> diff --git a/tests/mixedcontent1_sub.py b/tests/mixedcontent1_sub.py new file mode 100644 index 0000000000000000000000000000000000000000..1302fdc13495ffcbf6b2f1b82e965d77b326489e --- /dev/null +++ b/tests/mixedcontent1_sub.py @@ -0,0 +1,201 @@ +#!/usr/bin/env python + +# +# Generated by generateDS.py. +# Python 2.7.14 (default, Sep 23 2017, 22:06:14) [GCC 7.2.0] +# +# Command line options: +# ('--no-dates', '') +# ('--no-versions', '') +# ('--member-specs', 'list') +# ('-f', '') +# ('-o', 'tests/mixedcontent2_sup.py') +# ('-s', 'tests/mixedcontent2_sub.py') +# ('--super', 'mixedcontent2_sup') +# +# Command line arguments: +# tests/mixedcontent.xsd +# +# Command line: +# generateDS.py --no-dates --no-versions --member-specs="list" -f -o "tests/mixedcontent2_sup.py" -s "tests/mixedcontent2_sub.py" --super="mixedcontent2_sup" tests/mixedcontent.xsd +# +# Current working directory (os.getcwd()): +# generateds +# + +import sys +from lxml import etree as etree_ + +import mixedcontent2_sup as supermod + +def parsexml_(infile, parser=None, **kwargs): + if parser is None: + # Use the lxml ElementTree compatible parser so that, e.g., + # we ignore comments. + parser = etree_.ETCompatXMLParser() + doc = etree_.parse(infile, parser=parser, **kwargs) + return doc + +# +# Globals +# + +ExternalEncoding = 'ascii' + +# +# Data representation classes +# + + +class rootTypeSub(supermod.rootType): + def __init__(self, markup=None): + super(rootTypeSub, self).__init__(markup, ) +supermod.rootType.subclass = rootTypeSub +# end class rootTypeSub + + +class markupTypeSub(supermod.markupType): + def __init__(self, embedded=None, nested=None, valueOf_=None, mixedclass_=None, content_=None): + super(markupTypeSub, self).__init__(embedded, nested, valueOf_, mixedclass_, content_, ) +supermod.markupType.subclass = markupTypeSub +# end class markupTypeSub + + +class nestedTypeSub(supermod.nestedType): + def __init__(self, nested1=None, nested2=None, nested3=None): + super(nestedTypeSub, self).__init__(nested1, nested2, nested3, ) +supermod.nestedType.subclass = nestedTypeSub +# end class nestedTypeSub + + +class nested1TypeSub(supermod.nested1Type): + def __init__(self, nestedA1=None, nestedA2=None): + super(nested1TypeSub, self).__init__(nestedA1, nestedA2, ) +supermod.nested1Type.subclass = nested1TypeSub +# end class nested1TypeSub + + +class nested1ATypeSub(supermod.nested1AType): + def __init__(self, nestedB1=None, nestedB2=None): + super(nested1ATypeSub, self).__init__(nestedB1, nestedB2, ) +supermod.nested1AType.subclass = nested1ATypeSub +# end class nested1ATypeSub + + +def get_root_tag(node): + tag = supermod.Tag_pattern_.match(node.tag).groups()[-1] + rootClass = None + rootClass = supermod.GDSClassesMapping.get(tag) + if rootClass is None and hasattr(supermod, tag): + rootClass = getattr(supermod, tag) + return tag, rootClass + + +def parse(inFilename, silence=False): + parser = None + doc = parsexml_(inFilename, parser) + rootNode = doc.getroot() + rootTag, rootClass = get_root_tag(rootNode) + if rootClass is None: + rootTag = 'rootType' + rootClass = supermod.rootType + rootObj = rootClass.factory() + rootObj.build(rootNode) + # Enable Python to collect the space used by the DOM. + doc = None + if not silence: + sys.stdout.write('<?xml version="1.0" ?>\n') + rootObj.export( + sys.stdout, 0, name_=rootTag, + namespacedef_='', + pretty_print=True) + return rootObj + + +def parseEtree(inFilename, silence=False): + parser = None + doc = parsexml_(inFilename, parser) + rootNode = doc.getroot() + rootTag, rootClass = get_root_tag(rootNode) + if rootClass is None: + rootTag = 'rootType' + rootClass = supermod.rootType + rootObj = rootClass.factory() + rootObj.build(rootNode) + # Enable Python to collect the space used by the DOM. + doc = None + mapping = {} + rootElement = rootObj.to_etree(None, name_=rootTag, mapping_=mapping) + reverse_mapping = rootObj.gds_reverse_node_mapping(mapping) + if not silence: + content = etree_.tostring( + rootElement, pretty_print=True, + xml_declaration=True, encoding="utf-8") + sys.stdout.write(content) + sys.stdout.write('\n') + return rootObj, rootElement, mapping, reverse_mapping + + +def parseString(inString, silence=False): + from StringIO import StringIO + parser = None + doc = parsexml_(StringIO(inString), parser) + rootNode = doc.getroot() + rootTag, rootClass = get_root_tag(rootNode) + if rootClass is None: + rootTag = 'rootType' + rootClass = supermod.rootType + rootObj = rootClass.factory() + rootObj.build(rootNode) + # Enable Python to collect the space used by the DOM. + doc = None + if not silence: + sys.stdout.write('<?xml version="1.0" ?>\n') + rootObj.export( + sys.stdout, 0, name_=rootTag, + namespacedef_='') + return rootObj + + +def parseLiteral(inFilename, silence=False): + parser = None + doc = parsexml_(inFilename, parser) + rootNode = doc.getroot() + rootTag, rootClass = get_root_tag(rootNode) + if rootClass is None: + rootTag = 'rootType' + rootClass = supermod.rootType + rootObj = rootClass.factory() + rootObj.build(rootNode) + # Enable Python to collect the space used by the DOM. + doc = None + if not silence: + sys.stdout.write('#from mixedcontent2_sup import *\n\n') + sys.stdout.write('import mixedcontent2_sup as model_\n\n') + sys.stdout.write('rootObj = model_.rootClass(\n') + rootObj.exportLiteral(sys.stdout, 0, name_=rootTag) + sys.stdout.write(')\n') + return rootObj + + +USAGE_TEXT = """ +Usage: python ???.py <infilename> +""" + + +def usage(): + print(USAGE_TEXT) + sys.exit(1) + + +def main(): + args = sys.argv[1:] + if len(args) != 1: + usage() + infilename = args[0] + parse(infilename) + + +if __name__ == '__main__': + #import pdb; pdb.set_trace() + main() diff --git a/tests/mixedcontent1_sup.py b/tests/mixedcontent1_sup.py new file mode 100644 index 0000000000000000000000000000000000000000..59f9c98fe47f68eacd845e30b426ee52fcfc2a48 --- /dev/null +++ b/tests/mixedcontent1_sup.py @@ -0,0 +1,1385 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +# +# Generated by generateDS.py. +# Python 2.7.14 (default, Sep 23 2017, 22:06:14) [GCC 7.2.0] +# +# Command line options: +# ('--no-dates', '') +# ('--no-versions', '') +# ('--member-specs', 'list') +# ('-f', '') +# ('-o', 'tests/mixedcontent2_sup.py') +# ('-s', 'tests/mixedcontent2_sub.py') +# ('--super', 'mixedcontent2_sup') +# +# Command line arguments: +# tests/mixedcontent.xsd +# +# Command line: +# generateDS.py --no-dates --no-versions --member-specs="list" -f -o "tests/mixedcontent2_sup.py" -s "tests/mixedcontent2_sub.py" --super="mixedcontent2_sup" tests/mixedcontent.xsd +# +# Current working directory (os.getcwd()): +# generateds +# + +import sys +import re as re_ +import base64 +import datetime as datetime_ +import warnings as warnings_ +try: + from lxml import etree as etree_ +except ImportError: + from xml.etree import ElementTree as etree_ + + +Validate_simpletypes_ = True +if sys.version_info.major == 2: + BaseStrType_ = basestring +else: + BaseStrType_ = str + + +def parsexml_(infile, parser=None, **kwargs): + if parser is None: + # Use the lxml ElementTree compatible parser so that, e.g., + # we ignore comments. + try: + parser = etree_.ETCompatXMLParser() + except AttributeError: + # fallback to xml.etree + parser = etree_.XMLParser() + doc = etree_.parse(infile, parser=parser, **kwargs) + return doc + +# +# Namespace prefix definition table (and other attributes, too) +# +# The module generatedsnamespaces, if it is importable, must contain +# a dictionary named GeneratedsNamespaceDefs. This Python dictionary +# should map element type names (strings) to XML schema namespace prefix +# definitions. The export method for any class for which there is +# a namespace prefix definition, will export that definition in the +# XML representation of that element. See the export method of +# any generated element type class for a example of the use of this +# table. +# A sample table is: +# +# # File: generatedsnamespaces.py +# +# GenerateDSNamespaceDefs = { +# "ElementtypeA": "http://www.xxx.com/namespaceA", +# "ElementtypeB": "http://www.xxx.com/namespaceB", +# } +# + +try: + from generatedsnamespaces import GenerateDSNamespaceDefs as GenerateDSNamespaceDefs_ +except ImportError: + GenerateDSNamespaceDefs_ = {} + +# +# The root super-class for element type classes +# +# Calls to the methods in these classes are generated by generateDS.py. +# You can replace these methods by re-implementing the following class +# in a module named generatedssuper.py. + +try: + from generatedssuper import GeneratedsSuper +except ImportError as exp: + + class GeneratedsSuper(object): + tzoff_pattern = re_.compile(r'(\+|-)((0\d|1[0-3]):[0-5]\d|14:00)$') + class _FixedOffsetTZ(datetime_.tzinfo): + def __init__(self, offset, name): + self.__offset = datetime_.timedelta(minutes=offset) + self.__name = name + def utcoffset(self, dt): + return self.__offset + def tzname(self, dt): + return self.__name + def dst(self, dt): + return None + def gds_format_string(self, input_data, input_name=''): + return input_data + def gds_validate_string(self, input_data, node=None, input_name=''): + if not input_data: + return '' + else: + return input_data + def gds_format_base64(self, input_data, input_name=''): + return base64.b64encode(input_data) + def gds_validate_base64(self, input_data, node=None, input_name=''): + return input_data + def gds_format_integer(self, input_data, input_name=''): + return '%d' % input_data + def gds_validate_integer(self, input_data, node=None, input_name=''): + return input_data + def gds_format_integer_list(self, input_data, input_name=''): + return '%s' % ' '.join(input_data) + def gds_validate_integer_list( + self, input_data, node=None, input_name=''): + values = input_data.split() + for value in values: + try: + int(value) + except (TypeError, ValueError): + raise_parse_error(node, 'Requires sequence of integers') + return values + def gds_format_float(self, input_data, input_name=''): + return ('%.15f' % input_data).rstrip('0') + def gds_validate_float(self, input_data, node=None, input_name=''): + return input_data + def gds_format_float_list(self, input_data, input_name=''): + return '%s' % ' '.join(input_data) + def gds_validate_float_list( + self, input_data, node=None, input_name=''): + values = input_data.split() + for value in values: + try: + float(value) + except (TypeError, ValueError): + raise_parse_error(node, 'Requires sequence of floats') + return values + def gds_format_double(self, input_data, input_name=''): + return '%e' % input_data + def gds_validate_double(self, input_data, node=None, input_name=''): + return input_data + def gds_format_double_list(self, input_data, input_name=''): + return '%s' % ' '.join(input_data) + def gds_validate_double_list( + self, input_data, node=None, input_name=''): + values = input_data.split() + for value in values: + try: + float(value) + except (TypeError, ValueError): + raise_parse_error(node, 'Requires sequence of doubles') + return values + def gds_format_boolean(self, input_data, input_name=''): + return ('%s' % input_data).lower() + def gds_validate_boolean(self, input_data, node=None, input_name=''): + return input_data + def gds_format_boolean_list(self, input_data, input_name=''): + return '%s' % ' '.join(input_data) + def gds_validate_boolean_list( + self, input_data, node=None, input_name=''): + values = input_data.split() + for value in values: + if value not in ('true', '1', 'false', '0', ): + raise_parse_error( + node, + 'Requires sequence of booleans ' + '("true", "1", "false", "0")') + return values + def gds_validate_datetime(self, input_data, node=None, input_name=''): + return input_data + def gds_format_datetime(self, input_data, input_name=''): + if input_data.microsecond == 0: + _svalue = '%04d-%02d-%02dT%02d:%02d:%02d' % ( + input_data.year, + input_data.month, + input_data.day, + input_data.hour, + input_data.minute, + input_data.second, + ) + else: + _svalue = '%04d-%02d-%02dT%02d:%02d:%02d.%s' % ( + input_data.year, + input_data.month, + input_data.day, + input_data.hour, + input_data.minute, + input_data.second, + ('%f' % (float(input_data.microsecond) / 1000000))[2:], + ) + if input_data.tzinfo is not None: + tzoff = input_data.tzinfo.utcoffset(input_data) + if tzoff is not None: + total_seconds = tzoff.seconds + (86400 * tzoff.days) + if total_seconds == 0: + _svalue += 'Z' + else: + if total_seconds < 0: + _svalue += '-' + total_seconds *= -1 + else: + _svalue += '+' + hours = total_seconds // 3600 + minutes = (total_seconds - (hours * 3600)) // 60 + _svalue += '{0:02d}:{1:02d}'.format(hours, minutes) + return _svalue + @classmethod + def gds_parse_datetime(cls, input_data): + tz = None + if input_data[-1] == 'Z': + tz = GeneratedsSuper._FixedOffsetTZ(0, 'UTC') + input_data = input_data[:-1] + else: + results = GeneratedsSuper.tzoff_pattern.search(input_data) + if results is not None: + tzoff_parts = results.group(2).split(':') + tzoff = int(tzoff_parts[0]) * 60 + int(tzoff_parts[1]) + if results.group(1) == '-': + tzoff *= -1 + tz = GeneratedsSuper._FixedOffsetTZ( + tzoff, results.group(0)) + input_data = input_data[:-6] + time_parts = input_data.split('.') + if len(time_parts) > 1: + micro_seconds = int(float('0.' + time_parts[1]) * 1000000) + input_data = '%s.%s' % (time_parts[0], micro_seconds, ) + dt = datetime_.datetime.strptime( + input_data, '%Y-%m-%dT%H:%M:%S.%f') + else: + dt = datetime_.datetime.strptime( + input_data, '%Y-%m-%dT%H:%M:%S') + dt = dt.replace(tzinfo=tz) + return dt + def gds_validate_date(self, input_data, node=None, input_name=''): + return input_data + def gds_format_date(self, input_data, input_name=''): + _svalue = '%04d-%02d-%02d' % ( + input_data.year, + input_data.month, + input_data.day, + ) + try: + if input_data.tzinfo is not None: + tzoff = input_data.tzinfo.utcoffset(input_data) + if tzoff is not None: + total_seconds = tzoff.seconds + (86400 * tzoff.days) + if total_seconds == 0: + _svalue += 'Z' + else: + if total_seconds < 0: + _svalue += '-' + total_seconds *= -1 + else: + _svalue += '+' + hours = total_seconds // 3600 + minutes = (total_seconds - (hours * 3600)) // 60 + _svalue += '{0:02d}:{1:02d}'.format( + hours, minutes) + except AttributeError: + pass + return _svalue + @classmethod + def gds_parse_date(cls, input_data): + tz = None + if input_data[-1] == 'Z': + tz = GeneratedsSuper._FixedOffsetTZ(0, 'UTC') + input_data = input_data[:-1] + else: + results = GeneratedsSuper.tzoff_pattern.search(input_data) + if results is not None: + tzoff_parts = results.group(2).split(':') + tzoff = int(tzoff_parts[0]) * 60 + int(tzoff_parts[1]) + if results.group(1) == '-': + tzoff *= -1 + tz = GeneratedsSuper._FixedOffsetTZ( + tzoff, results.group(0)) + input_data = input_data[:-6] + dt = datetime_.datetime.strptime(input_data, '%Y-%m-%d') + dt = dt.replace(tzinfo=tz) + return dt.date() + def gds_validate_time(self, input_data, node=None, input_name=''): + return input_data + def gds_format_time(self, input_data, input_name=''): + if input_data.microsecond == 0: + _svalue = '%02d:%02d:%02d' % ( + input_data.hour, + input_data.minute, + input_data.second, + ) + else: + _svalue = '%02d:%02d:%02d.%s' % ( + input_data.hour, + input_data.minute, + input_data.second, + ('%f' % (float(input_data.microsecond) / 1000000))[2:], + ) + if input_data.tzinfo is not None: + tzoff = input_data.tzinfo.utcoffset(input_data) + if tzoff is not None: + total_seconds = tzoff.seconds + (86400 * tzoff.days) + if total_seconds == 0: + _svalue += 'Z' + else: + if total_seconds < 0: + _svalue += '-' + total_seconds *= -1 + else: + _svalue += '+' + hours = total_seconds // 3600 + minutes = (total_seconds - (hours * 3600)) // 60 + _svalue += '{0:02d}:{1:02d}'.format(hours, minutes) + return _svalue + def gds_validate_simple_patterns(self, patterns, target): + # pat is a list of lists of strings/patterns. We should: + # - AND the outer elements + # - OR the inner elements + found1 = True + for patterns1 in patterns: + found2 = False + for patterns2 in patterns1: + if re_.search(patterns2, target) is not None: + found2 = True + break + if not found2: + found1 = False + break + return found1 + @classmethod + def gds_parse_time(cls, input_data): + tz = None + if input_data[-1] == 'Z': + tz = GeneratedsSuper._FixedOffsetTZ(0, 'UTC') + input_data = input_data[:-1] + else: + results = GeneratedsSuper.tzoff_pattern.search(input_data) + if results is not None: + tzoff_parts = results.group(2).split(':') + tzoff = int(tzoff_parts[0]) * 60 + int(tzoff_parts[1]) + if results.group(1) == '-': + tzoff *= -1 + tz = GeneratedsSuper._FixedOffsetTZ( + tzoff, results.group(0)) + input_data = input_data[:-6] + if len(input_data.split('.')) > 1: + dt = datetime_.datetime.strptime(input_data, '%H:%M:%S.%f') + else: + dt = datetime_.datetime.strptime(input_data, '%H:%M:%S') + dt = dt.replace(tzinfo=tz) + return dt.time() + def gds_str_lower(self, instring): + return instring.lower() + def get_path_(self, node): + path_list = [] + self.get_path_list_(node, path_list) + path_list.reverse() + path = '/'.join(path_list) + return path + Tag_strip_pattern_ = re_.compile(r'\{.*\}') + def get_path_list_(self, node, path_list): + if node is None: + return + tag = GeneratedsSuper.Tag_strip_pattern_.sub('', node.tag) + if tag: + path_list.append(tag) + self.get_path_list_(node.getparent(), path_list) + def get_class_obj_(self, node, default_class=None): + class_obj1 = default_class + if 'xsi' in node.nsmap: + classname = node.get('{%s}type' % node.nsmap['xsi']) + if classname is not None: + names = classname.split(':') + if len(names) == 2: + classname = names[1] + class_obj2 = globals().get(classname) + if class_obj2 is not None: + class_obj1 = class_obj2 + return class_obj1 + def gds_build_any(self, node, type_name=None): + return None + @classmethod + def gds_reverse_node_mapping(cls, mapping): + return dict(((v, k) for k, v in mapping.iteritems())) + @staticmethod + def gds_encode(instring): + if sys.version_info.major == 2: + return instring.encode(ExternalEncoding) + else: + return instring + @staticmethod + def convert_unicode(instring): + if isinstance(instring, str): + result = quote_xml(instring) + elif sys.version_info.major == 2 and isinstance(instring, unicode): + result = quote_xml(instring).encode('utf8') + else: + result = GeneratedsSuper.gds_encode(str(instring)) + return result + def __eq__(self, other): + if type(self) != type(other): + return False + return self.__dict__ == other.__dict__ + def __ne__(self, other): + return not self.__eq__(other) + + def getSubclassFromModule_(module, class_): + '''Get the subclass of a class from a specific module.''' + name = class_.__name__ + 'Sub' + if hasattr(module, name): + return getattr(module, name) + else: + return None + + +# +# If you have installed IPython you can uncomment and use the following. +# IPython is available from http://ipython.scipy.org/. +# + +## from IPython.Shell import IPShellEmbed +## args = '' +## ipshell = IPShellEmbed(args, +## banner = 'Dropping into IPython', +## exit_msg = 'Leaving Interpreter, back to program.') + +# Then use the following line where and when you want to drop into the +# IPython shell: +# ipshell('<some message> -- Entering ipshell.\nHit Ctrl-D to exit') + +# +# Globals +# + +ExternalEncoding = 'ascii' +Tag_pattern_ = re_.compile(r'({.*})?(.*)') +String_cleanup_pat_ = re_.compile(r"[\n\r\s]+") +Namespace_extract_pat_ = re_.compile(r'{(.*)}(.*)') +CDATA_pattern_ = re_.compile(r"<!\[CDATA\[.*?\]\]>", re_.DOTALL) + +# Change this to redirect the generated superclass module to use a +# specific subclass module. +CurrentSubclassModule_ = None + +# +# Support/utility functions. +# + + +def showIndent(outfile, level, pretty_print=True): + if pretty_print: + for idx in range(level): + outfile.write(' ') + + +def quote_xml(inStr): + "Escape markup chars, but do not modify CDATA sections." + if not inStr: + return '' + s1 = (isinstance(inStr, BaseStrType_) and inStr or '%s' % inStr) + s2 = '' + pos = 0 + matchobjects = CDATA_pattern_.finditer(s1) + for mo in matchobjects: + s3 = s1[pos:mo.start()] + s2 += quote_xml_aux(s3) + s2 += s1[mo.start():mo.end()] + pos = mo.end() + s3 = s1[pos:] + s2 += quote_xml_aux(s3) + return s2 + + +def quote_xml_aux(inStr): + s1 = inStr.replace('&', '&') + s1 = s1.replace('<', '<') + s1 = s1.replace('>', '>') + return s1 + + +def quote_attrib(inStr): + s1 = (isinstance(inStr, BaseStrType_) and inStr or '%s' % inStr) + s1 = s1.replace('&', '&') + s1 = s1.replace('<', '<') + s1 = s1.replace('>', '>') + if '"' in s1: + if "'" in s1: + s1 = '"%s"' % s1.replace('"', """) + else: + s1 = "'%s'" % s1 + else: + s1 = '"%s"' % s1 + return s1 + + +def quote_python(inStr): + s1 = inStr + if s1.find("'") == -1: + if s1.find('\n') == -1: + return "'%s'" % s1 + else: + return "'''%s'''" % s1 + else: + if s1.find('"') != -1: + s1 = s1.replace('"', '\\"') + if s1.find('\n') == -1: + return '"%s"' % s1 + else: + return '"""%s"""' % s1 + + +def get_all_text_(node): + if node.text is not None: + text = node.text + else: + text = '' + for child in node: + if child.tail is not None: + text += child.tail + return text + + +def find_attr_value_(attr_name, node): + attrs = node.attrib + attr_parts = attr_name.split(':') + value = None + if len(attr_parts) == 1: + value = attrs.get(attr_name) + elif len(attr_parts) == 2: + prefix, name = attr_parts + namespace = node.nsmap.get(prefix) + if namespace is not None: + value = attrs.get('{%s}%s' % (namespace, name, )) + return value + + +class GDSParseError(Exception): + pass + + +def raise_parse_error(node, msg): + msg = '%s (element %s/line %d)' % (msg, node.tag, node.sourceline, ) + raise GDSParseError(msg) + + +class MixedContainer: + # Constants for category: + CategoryNone = 0 + CategoryText = 1 + CategorySimple = 2 + CategoryComplex = 3 + # Constants for content_type: + TypeNone = 0 + TypeText = 1 + TypeString = 2 + TypeInteger = 3 + TypeFloat = 4 + TypeDecimal = 5 + TypeDouble = 6 + TypeBoolean = 7 + TypeBase64 = 8 + def __init__(self, category, content_type, name, value): + self.category = category + self.content_type = content_type + self.name = name + self.value = value + def getCategory(self): + return self.category + def getContenttype(self, content_type): + return self.content_type + def getValue(self): + return self.value + def getName(self): + return self.name + def export(self, outfile, level, name, namespace, + pretty_print=True): + if self.category == MixedContainer.CategoryText: + # Prevent exporting empty content as empty lines. + if self.value.strip(): + outfile.write(self.value) + elif self.category == MixedContainer.CategorySimple: + self.exportSimple(outfile, level, name) + else: # category == MixedContainer.CategoryComplex + self.value.export( + outfile, level, namespace, name, + pretty_print=pretty_print) + def exportSimple(self, outfile, level, name): + if self.content_type == MixedContainer.TypeString: + outfile.write('<%s>%s</%s>' % ( + self.name, self.value, self.name)) + elif self.content_type == MixedContainer.TypeInteger or \ + self.content_type == MixedContainer.TypeBoolean: + outfile.write('<%s>%d</%s>' % ( + self.name, self.value, self.name)) + elif self.content_type == MixedContainer.TypeFloat or \ + self.content_type == MixedContainer.TypeDecimal: + outfile.write('<%s>%f</%s>' % ( + self.name, self.value, self.name)) + elif self.content_type == MixedContainer.TypeDouble: + outfile.write('<%s>%g</%s>' % ( + self.name, self.value, self.name)) + elif self.content_type == MixedContainer.TypeBase64: + outfile.write('<%s>%s</%s>' % ( + self.name, + base64.b64encode(self.value), + self.name)) + def to_etree(self, element): + if self.category == MixedContainer.CategoryText: + # Prevent exporting empty content as empty lines. + if self.value.strip(): + if len(element) > 0: + if element[-1].tail is None: + element[-1].tail = self.value + else: + element[-1].tail += self.value + else: + if element.text is None: + element.text = self.value + else: + element.text += self.value + elif self.category == MixedContainer.CategorySimple: + subelement = etree_.SubElement( + element, '%s' % self.name) + subelement.text = self.to_etree_simple() + else: # category == MixedContainer.CategoryComplex + self.value.to_etree(element) + def to_etree_simple(self): + if self.content_type == MixedContainer.TypeString: + text = self.value + elif (self.content_type == MixedContainer.TypeInteger or + self.content_type == MixedContainer.TypeBoolean): + text = '%d' % self.value + elif (self.content_type == MixedContainer.TypeFloat or + self.content_type == MixedContainer.TypeDecimal): + text = '%f' % self.value + elif self.content_type == MixedContainer.TypeDouble: + text = '%g' % self.value + elif self.content_type == MixedContainer.TypeBase64: + text = '%s' % base64.b64encode(self.value) + return text + def exportLiteral(self, outfile, level, name): + if self.category == MixedContainer.CategoryText: + showIndent(outfile, level) + outfile.write( + 'model_.MixedContainer(%d, %d, "%s", "%s"),\n' % ( + self.category, self.content_type, + self.name, self.value)) + elif self.category == MixedContainer.CategorySimple: + showIndent(outfile, level) + outfile.write( + 'model_.MixedContainer(%d, %d, "%s", "%s"),\n' % ( + self.category, self.content_type, + self.name, self.value)) + else: # category == MixedContainer.CategoryComplex + showIndent(outfile, level) + outfile.write( + 'model_.MixedContainer(%d, %d, "%s",\n' % ( + self.category, self.content_type, self.name,)) + self.value.exportLiteral(outfile, level + 1) + showIndent(outfile, level) + outfile.write(')\n') + + +class MemberSpec_(object): + def __init__(self, name='', data_type='', container=0, + optional=0, child_attrs=None, choice=None): + self.name = name + self.data_type = data_type + self.container = container + self.child_attrs = child_attrs + self.choice = choice + self.optional = optional + def set_name(self, name): self.name = name + def get_name(self): return self.name + def set_data_type(self, data_type): self.data_type = data_type + def get_data_type_chain(self): return self.data_type + def get_data_type(self): + if isinstance(self.data_type, list): + if len(self.data_type) > 0: + return self.data_type[-1] + else: + return 'xs:string' + else: + return self.data_type + def set_container(self, container): self.container = container + def get_container(self): return self.container + def set_child_attrs(self, child_attrs): self.child_attrs = child_attrs + def get_child_attrs(self): return self.child_attrs + def set_choice(self, choice): self.choice = choice + def get_choice(self): return self.choice + def set_optional(self, optional): self.optional = optional + def get_optional(self): return self.optional + + +def _cast(typ, value): + if typ is None or value is None: + return value + return typ(value) + +# +# Data representation classes. +# + + +class rootType(GeneratedsSuper): + member_data_items_ = [ + MemberSpec_('markup', 'markupType', 1, 0, {u'maxOccurs': u'unbounded', u'type': u'markupType', u'name': u'markup'}, None), + ] + subclass = None + superclass = None + def __init__(self, markup=None): + self.original_tagname_ = None + if markup is None: + self.markup = [] + else: + self.markup = markup + def factory(*args_, **kwargs_): + if CurrentSubclassModule_ is not None: + subclass = getSubclassFromModule_( + CurrentSubclassModule_, rootType) + if subclass is not None: + return subclass(*args_, **kwargs_) + if rootType.subclass: + return rootType.subclass(*args_, **kwargs_) + else: + return rootType(*args_, **kwargs_) + factory = staticmethod(factory) + def get_markup(self): return self.markup + def set_markup(self, markup): self.markup = markup + def add_markup(self, value): self.markup.append(value) + def insert_markup_at(self, index, value): self.markup.insert(index, value) + def replace_markup_at(self, index, value): self.markup[index] = value + def hasContent_(self): + if ( + self.markup + ): + return True + else: + return False + def export(self, outfile, level, namespace_='', name_='rootType', namespacedef_='', pretty_print=True): + imported_ns_def_ = GenerateDSNamespaceDefs_.get('rootType') + if imported_ns_def_ is not None: + namespacedef_ = imported_ns_def_ + if pretty_print: + eol_ = '\n' + else: + eol_ = '' + if self.original_tagname_ is not None: + name_ = self.original_tagname_ + showIndent(outfile, level, pretty_print) + outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) + already_processed = set() + self.exportAttributes(outfile, level, already_processed, namespace_, name_='rootType') + if self.hasContent_(): + outfile.write('>%s' % (eol_, )) + self.exportChildren(outfile, level + 1, namespace_='', name_='rootType', pretty_print=pretty_print) + showIndent(outfile, level, pretty_print) + outfile.write('</%s%s>%s' % (namespace_, name_, eol_)) + else: + outfile.write('/>%s' % (eol_, )) + def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='rootType'): + pass + def exportChildren(self, outfile, level, namespace_='', name_='rootType', fromsubclass_=False, pretty_print=True): + if pretty_print: + eol_ = '\n' + else: + eol_ = '' + for markup_ in self.markup: + markup_.export(outfile, level, namespace_, name_='markup', pretty_print=pretty_print) + def build(self, node): + already_processed = set() + self.buildAttributes(node, node.attrib, already_processed) + for child in node: + nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] + self.buildChildren(child, node, nodeName_) + return self + def buildAttributes(self, node, attrs, already_processed): + pass + def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): + if nodeName_ == 'markup': + obj_ = markupType.factory() + obj_.build(child_) + self.markup.append(obj_) + obj_.original_tagname_ = 'markup' +# end class rootType + + +class markupType(GeneratedsSuper): + member_data_items_ = [ + MemberSpec_('embedded', 'xs:string', 1, 1, {u'maxOccurs': u'unbounded', u'type': u'xs:string', u'name': u'embedded', u'minOccurs': u'0'}, None), + MemberSpec_('nested', 'nestedType', 1, 1, {u'maxOccurs': u'unbounded', u'type': u'nestedType', u'name': u'nested', u'minOccurs': u'0'}, None), + MemberSpec_('valueOf_', [], 0), + ] + subclass = None + superclass = None + def __init__(self, embedded=None, nested=None, valueOf_=None, mixedclass_=None, content_=None): + self.original_tagname_ = None + if embedded is None: + self.embedded = [] + else: + self.embedded = embedded + if nested is None: + self.nested = [] + else: + self.nested = nested + self.valueOf_ = valueOf_ + if mixedclass_ is None: + self.mixedclass_ = MixedContainer + else: + self.mixedclass_ = mixedclass_ + if content_ is None: + self.content_ = [] + else: + self.content_ = content_ + self.valueOf_ = valueOf_ + def factory(*args_, **kwargs_): + if CurrentSubclassModule_ is not None: + subclass = getSubclassFromModule_( + CurrentSubclassModule_, markupType) + if subclass is not None: + return subclass(*args_, **kwargs_) + if markupType.subclass: + return markupType.subclass(*args_, **kwargs_) + else: + return markupType(*args_, **kwargs_) + factory = staticmethod(factory) + def get_embedded(self): return self.embedded + def set_embedded(self, embedded): self.embedded = embedded + def add_embedded(self, value): self.embedded.append(value) + def insert_embedded_at(self, index, value): self.embedded.insert(index, value) + def replace_embedded_at(self, index, value): self.embedded[index] = value + def get_nested(self): return self.nested + def set_nested(self, nested): self.nested = nested + def add_nested(self, value): self.nested.append(value) + def insert_nested_at(self, index, value): self.nested.insert(index, value) + def replace_nested_at(self, index, value): self.nested[index] = value + def get_valueOf_(self): return self.valueOf_ + def set_valueOf_(self, valueOf_): self.valueOf_ = valueOf_ + def hasContent_(self): + if ( + self.embedded or + self.nested or + (1 if type(self.valueOf_) in [int,float] else self.valueOf_) + ): + return True + else: + return False + def export(self, outfile, level, namespace_='', name_='markupType', namespacedef_='', pretty_print=True): + imported_ns_def_ = GenerateDSNamespaceDefs_.get('markupType') + if imported_ns_def_ is not None: + namespacedef_ = imported_ns_def_ + if pretty_print: + eol_ = '\n' + else: + eol_ = '' + if self.original_tagname_ is not None: + name_ = self.original_tagname_ + showIndent(outfile, level, pretty_print) + outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) + already_processed = set() + self.exportAttributes(outfile, level, already_processed, namespace_, name_='markupType') + if self.hasContent_(): + outfile.write('>%s' % (eol_, )) + self.exportChildren(outfile, level + 1, namespace_='', name_='markupType', pretty_print=pretty_print) + showIndent(outfile, level, pretty_print) + outfile.write('</%s%s>%s' % (namespace_, name_, eol_)) + else: + outfile.write('/>%s' % (eol_, )) + def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='markupType'): + pass + def exportChildren(self, outfile, level, namespace_='', name_='markupType', fromsubclass_=False, pretty_print=True): + if not fromsubclass_: + for item_ in self.content_: + item_.export(outfile, level, item_.name, namespace_, pretty_print=pretty_print) + if pretty_print: + eol_ = '\n' + else: + eol_ = '' + for embedded_ in self.embedded: + showIndent(outfile, level, pretty_print) + outfile.write('<embedded>%s</embedded>%s' % (self.gds_encode(self.gds_format_string(quote_xml(embedded_), input_name='embedded')), eol_)) + for nested_ in self.nested: + nested_.export(outfile, level, namespace_, name_='nested', pretty_print=pretty_print) + def build(self, node): + already_processed = set() + self.buildAttributes(node, node.attrib, already_processed) + self.valueOf_ = get_all_text_(node) + if node.text is not None: + obj_ = self.mixedclass_(MixedContainer.CategoryText, + MixedContainer.TypeNone, '', node.text) + self.content_.append(obj_) + for child in node: + nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] + self.buildChildren(child, node, nodeName_) + return self + def buildAttributes(self, node, attrs, already_processed): + pass + def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): + if nodeName_ == 'embedded' and child_.text is not None: + valuestr_ = child_.text + obj_ = self.mixedclass_(MixedContainer.CategorySimple, + MixedContainer.TypeString, 'embedded', valuestr_) + self.content_.append(obj_) + elif nodeName_ == 'nested': + obj_ = nestedType.factory() + obj_.build(child_) + obj_ = self.mixedclass_(MixedContainer.CategoryComplex, + MixedContainer.TypeNone, 'nested', obj_) + self.content_.append(obj_) + if hasattr(self, 'add_nested'): + self.add_nested(obj_.value) + elif hasattr(self, 'set_nested'): + self.set_nested(obj_.value) + if not fromsubclass_ and child_.tail is not None: + obj_ = self.mixedclass_(MixedContainer.CategoryText, + MixedContainer.TypeNone, '', child_.tail) + self.content_.append(obj_) +# end class markupType + + +class nestedType(GeneratedsSuper): + member_data_items_ = [ + MemberSpec_('nested1', 'nested1Type', 1, 1, {u'maxOccurs': u'unbounded', u'type': u'nested1Type', u'name': u'nested1', u'minOccurs': u'0'}, None), + MemberSpec_('nested2', 'xs:string', 1, 1, {u'maxOccurs': u'unbounded', u'type': u'xs:string', u'name': u'nested2', u'minOccurs': u'0'}, None), + MemberSpec_('nested3', 'xs:integer', 1, 1, {u'maxOccurs': u'unbounded', u'type': u'xs:integer', u'name': u'nested3', u'minOccurs': u'0'}, None), + ] + subclass = None + superclass = None + def __init__(self, nested1=None, nested2=None, nested3=None): + self.original_tagname_ = None + if nested1 is None: + self.nested1 = [] + else: + self.nested1 = nested1 + if nested2 is None: + self.nested2 = [] + else: + self.nested2 = nested2 + if nested3 is None: + self.nested3 = [] + else: + self.nested3 = nested3 + def factory(*args_, **kwargs_): + if CurrentSubclassModule_ is not None: + subclass = getSubclassFromModule_( + CurrentSubclassModule_, nestedType) + if subclass is not None: + return subclass(*args_, **kwargs_) + if nestedType.subclass: + return nestedType.subclass(*args_, **kwargs_) + else: + return nestedType(*args_, **kwargs_) + factory = staticmethod(factory) + def get_nested1(self): return self.nested1 + def set_nested1(self, nested1): self.nested1 = nested1 + def add_nested1(self, value): self.nested1.append(value) + def insert_nested1_at(self, index, value): self.nested1.insert(index, value) + def replace_nested1_at(self, index, value): self.nested1[index] = value + def get_nested2(self): return self.nested2 + def set_nested2(self, nested2): self.nested2 = nested2 + def add_nested2(self, value): self.nested2.append(value) + def insert_nested2_at(self, index, value): self.nested2.insert(index, value) + def replace_nested2_at(self, index, value): self.nested2[index] = value + def get_nested3(self): return self.nested3 + def set_nested3(self, nested3): self.nested3 = nested3 + def add_nested3(self, value): self.nested3.append(value) + def insert_nested3_at(self, index, value): self.nested3.insert(index, value) + def replace_nested3_at(self, index, value): self.nested3[index] = value + def hasContent_(self): + if ( + self.nested1 or + self.nested2 or + self.nested3 + ): + return True + else: + return False + def export(self, outfile, level, namespace_='', name_='nestedType', namespacedef_='', pretty_print=True): + imported_ns_def_ = GenerateDSNamespaceDefs_.get('nestedType') + if imported_ns_def_ is not None: + namespacedef_ = imported_ns_def_ + if pretty_print: + eol_ = '\n' + else: + eol_ = '' + if self.original_tagname_ is not None: + name_ = self.original_tagname_ + showIndent(outfile, level, pretty_print) + outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) + already_processed = set() + self.exportAttributes(outfile, level, already_processed, namespace_, name_='nestedType') + if self.hasContent_(): + outfile.write('>%s' % (eol_, )) + self.exportChildren(outfile, level + 1, namespace_='', name_='nestedType', pretty_print=pretty_print) + showIndent(outfile, level, pretty_print) + outfile.write('</%s%s>%s' % (namespace_, name_, eol_)) + else: + outfile.write('/>%s' % (eol_, )) + def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='nestedType'): + pass + def exportChildren(self, outfile, level, namespace_='', name_='nestedType', fromsubclass_=False, pretty_print=True): + if pretty_print: + eol_ = '\n' + else: + eol_ = '' + for nested1_ in self.nested1: + nested1_.export(outfile, level, namespace_, name_='nested1', pretty_print=pretty_print) + for nested2_ in self.nested2: + showIndent(outfile, level, pretty_print) + outfile.write('<nested2>%s</nested2>%s' % (self.gds_encode(self.gds_format_string(quote_xml(nested2_), input_name='nested2')), eol_)) + for nested3_ in self.nested3: + showIndent(outfile, level, pretty_print) + outfile.write('<nested3>%s</nested3>%s' % (self.gds_format_integer(nested3_, input_name='nested3'), eol_)) + def build(self, node): + already_processed = set() + self.buildAttributes(node, node.attrib, already_processed) + for child in node: + nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] + self.buildChildren(child, node, nodeName_) + return self + def buildAttributes(self, node, attrs, already_processed): + pass + def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): + if nodeName_ == 'nested1': + obj_ = nested1Type.factory() + obj_.build(child_) + self.nested1.append(obj_) + obj_.original_tagname_ = 'nested1' + elif nodeName_ == 'nested2': + nested2_ = child_.text + nested2_ = self.gds_validate_string(nested2_, node, 'nested2') + self.nested2.append(nested2_) + elif nodeName_ == 'nested3': + sval_ = child_.text + try: + ival_ = int(sval_) + except (TypeError, ValueError) as exp: + raise_parse_error(child_, 'requires integer: %s' % exp) + ival_ = self.gds_validate_integer(ival_, node, 'nested3') + self.nested3.append(ival_) +# end class nestedType + + +class nested1Type(GeneratedsSuper): + member_data_items_ = [ + MemberSpec_('nestedA1', 'nested1AType', 1, 1, {u'maxOccurs': u'unbounded', u'type': u'nested1AType', u'name': u'nestedA1', u'minOccurs': u'0'}, None), + MemberSpec_('nestedA2', 'nested1AType', 1, 1, {u'maxOccurs': u'unbounded', u'type': u'nested1AType', u'name': u'nestedA2', u'minOccurs': u'0'}, None), + ] + subclass = None + superclass = None + def __init__(self, nestedA1=None, nestedA2=None): + self.original_tagname_ = None + if nestedA1 is None: + self.nestedA1 = [] + else: + self.nestedA1 = nestedA1 + if nestedA2 is None: + self.nestedA2 = [] + else: + self.nestedA2 = nestedA2 + def factory(*args_, **kwargs_): + if CurrentSubclassModule_ is not None: + subclass = getSubclassFromModule_( + CurrentSubclassModule_, nested1Type) + if subclass is not None: + return subclass(*args_, **kwargs_) + if nested1Type.subclass: + return nested1Type.subclass(*args_, **kwargs_) + else: + return nested1Type(*args_, **kwargs_) + factory = staticmethod(factory) + def get_nestedA1(self): return self.nestedA1 + def set_nestedA1(self, nestedA1): self.nestedA1 = nestedA1 + def add_nestedA1(self, value): self.nestedA1.append(value) + def insert_nestedA1_at(self, index, value): self.nestedA1.insert(index, value) + def replace_nestedA1_at(self, index, value): self.nestedA1[index] = value + def get_nestedA2(self): return self.nestedA2 + def set_nestedA2(self, nestedA2): self.nestedA2 = nestedA2 + def add_nestedA2(self, value): self.nestedA2.append(value) + def insert_nestedA2_at(self, index, value): self.nestedA2.insert(index, value) + def replace_nestedA2_at(self, index, value): self.nestedA2[index] = value + def hasContent_(self): + if ( + self.nestedA1 or + self.nestedA2 + ): + return True + else: + return False + def export(self, outfile, level, namespace_='', name_='nested1Type', namespacedef_='', pretty_print=True): + imported_ns_def_ = GenerateDSNamespaceDefs_.get('nested1Type') + if imported_ns_def_ is not None: + namespacedef_ = imported_ns_def_ + if pretty_print: + eol_ = '\n' + else: + eol_ = '' + if self.original_tagname_ is not None: + name_ = self.original_tagname_ + showIndent(outfile, level, pretty_print) + outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) + already_processed = set() + self.exportAttributes(outfile, level, already_processed, namespace_, name_='nested1Type') + if self.hasContent_(): + outfile.write('>%s' % (eol_, )) + self.exportChildren(outfile, level + 1, namespace_='', name_='nested1Type', pretty_print=pretty_print) + showIndent(outfile, level, pretty_print) + outfile.write('</%s%s>%s' % (namespace_, name_, eol_)) + else: + outfile.write('/>%s' % (eol_, )) + def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='nested1Type'): + pass + def exportChildren(self, outfile, level, namespace_='', name_='nested1Type', fromsubclass_=False, pretty_print=True): + if pretty_print: + eol_ = '\n' + else: + eol_ = '' + for nestedA1_ in self.nestedA1: + nestedA1_.export(outfile, level, namespace_, name_='nestedA1', pretty_print=pretty_print) + for nestedA2_ in self.nestedA2: + nestedA2_.export(outfile, level, namespace_, name_='nestedA2', pretty_print=pretty_print) + def build(self, node): + already_processed = set() + self.buildAttributes(node, node.attrib, already_processed) + for child in node: + nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] + self.buildChildren(child, node, nodeName_) + return self + def buildAttributes(self, node, attrs, already_processed): + pass + def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): + if nodeName_ == 'nestedA1': + obj_ = nested1AType.factory() + obj_.build(child_) + self.nestedA1.append(obj_) + obj_.original_tagname_ = 'nestedA1' + elif nodeName_ == 'nestedA2': + obj_ = nested1AType.factory() + obj_.build(child_) + self.nestedA2.append(obj_) + obj_.original_tagname_ = 'nestedA2' +# end class nested1Type + + +class nested1AType(GeneratedsSuper): + member_data_items_ = [ + MemberSpec_('nestedB1', 'xs:string', 1, 0, {u'maxOccurs': u'unbounded', u'type': u'xs:string', u'name': u'nestedB1'}, None), + MemberSpec_('nestedB2', 'xs:string', 1, 0, {u'maxOccurs': u'unbounded', u'type': u'xs:string', u'name': u'nestedB2'}, None), + ] + subclass = None + superclass = None + def __init__(self, nestedB1=None, nestedB2=None): + self.original_tagname_ = None + if nestedB1 is None: + self.nestedB1 = [] + else: + self.nestedB1 = nestedB1 + if nestedB2 is None: + self.nestedB2 = [] + else: + self.nestedB2 = nestedB2 + def factory(*args_, **kwargs_): + if CurrentSubclassModule_ is not None: + subclass = getSubclassFromModule_( + CurrentSubclassModule_, nested1AType) + if subclass is not None: + return subclass(*args_, **kwargs_) + if nested1AType.subclass: + return nested1AType.subclass(*args_, **kwargs_) + else: + return nested1AType(*args_, **kwargs_) + factory = staticmethod(factory) + def get_nestedB1(self): return self.nestedB1 + def set_nestedB1(self, nestedB1): self.nestedB1 = nestedB1 + def add_nestedB1(self, value): self.nestedB1.append(value) + def insert_nestedB1_at(self, index, value): self.nestedB1.insert(index, value) + def replace_nestedB1_at(self, index, value): self.nestedB1[index] = value + def get_nestedB2(self): return self.nestedB2 + def set_nestedB2(self, nestedB2): self.nestedB2 = nestedB2 + def add_nestedB2(self, value): self.nestedB2.append(value) + def insert_nestedB2_at(self, index, value): self.nestedB2.insert(index, value) + def replace_nestedB2_at(self, index, value): self.nestedB2[index] = value + def hasContent_(self): + if ( + self.nestedB1 or + self.nestedB2 + ): + return True + else: + return False + def export(self, outfile, level, namespace_='', name_='nested1AType', namespacedef_='', pretty_print=True): + imported_ns_def_ = GenerateDSNamespaceDefs_.get('nested1AType') + if imported_ns_def_ is not None: + namespacedef_ = imported_ns_def_ + if pretty_print: + eol_ = '\n' + else: + eol_ = '' + if self.original_tagname_ is not None: + name_ = self.original_tagname_ + showIndent(outfile, level, pretty_print) + outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) + already_processed = set() + self.exportAttributes(outfile, level, already_processed, namespace_, name_='nested1AType') + if self.hasContent_(): + outfile.write('>%s' % (eol_, )) + self.exportChildren(outfile, level + 1, namespace_='', name_='nested1AType', pretty_print=pretty_print) + showIndent(outfile, level, pretty_print) + outfile.write('</%s%s>%s' % (namespace_, name_, eol_)) + else: + outfile.write('/>%s' % (eol_, )) + def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='nested1AType'): + pass + def exportChildren(self, outfile, level, namespace_='', name_='nested1AType', fromsubclass_=False, pretty_print=True): + if pretty_print: + eol_ = '\n' + else: + eol_ = '' + for nestedB1_ in self.nestedB1: + showIndent(outfile, level, pretty_print) + outfile.write('<nestedB1>%s</nestedB1>%s' % (self.gds_encode(self.gds_format_string(quote_xml(nestedB1_), input_name='nestedB1')), eol_)) + for nestedB2_ in self.nestedB2: + showIndent(outfile, level, pretty_print) + outfile.write('<nestedB2>%s</nestedB2>%s' % (self.gds_encode(self.gds_format_string(quote_xml(nestedB2_), input_name='nestedB2')), eol_)) + def build(self, node): + already_processed = set() + self.buildAttributes(node, node.attrib, already_processed) + for child in node: + nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] + self.buildChildren(child, node, nodeName_) + return self + def buildAttributes(self, node, attrs, already_processed): + pass + def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): + if nodeName_ == 'nestedB1': + nestedB1_ = child_.text + nestedB1_ = self.gds_validate_string(nestedB1_, node, 'nestedB1') + self.nestedB1.append(nestedB1_) + elif nodeName_ == 'nestedB2': + nestedB2_ = child_.text + nestedB2_ = self.gds_validate_string(nestedB2_, node, 'nestedB2') + self.nestedB2.append(nestedB2_) +# end class nested1AType + + +GDSClassesMapping = { + 'root': rootType, +} + + +USAGE_TEXT = """ +Usage: python <Parser>.py [ -s ] <in_xml_file> +""" + + +def usage(): + print(USAGE_TEXT) + sys.exit(1) + + +def get_root_tag(node): + tag = Tag_pattern_.match(node.tag).groups()[-1] + rootClass = GDSClassesMapping.get(tag) + if rootClass is None: + rootClass = globals().get(tag) + return tag, rootClass + + +def parse(inFileName, silence=False): + parser = None + doc = parsexml_(inFileName, parser) + rootNode = doc.getroot() + rootTag, rootClass = get_root_tag(rootNode) + if rootClass is None: + rootTag = 'rootType' + rootClass = rootType + rootObj = rootClass.factory() + rootObj.build(rootNode) + # Enable Python to collect the space used by the DOM. + doc = None + if not silence: + sys.stdout.write('<?xml version="1.0" ?>\n') + rootObj.export( + sys.stdout, 0, name_=rootTag, + namespacedef_='', + pretty_print=True) + return rootObj + + +def parseEtree(inFileName, silence=False): + parser = None + doc = parsexml_(inFileName, parser) + rootNode = doc.getroot() + rootTag, rootClass = get_root_tag(rootNode) + if rootClass is None: + rootTag = 'rootType' + rootClass = rootType + rootObj = rootClass.factory() + rootObj.build(rootNode) + # Enable Python to collect the space used by the DOM. + doc = None + mapping = {} + rootElement = rootObj.to_etree(None, name_=rootTag, mapping_=mapping) + reverse_mapping = rootObj.gds_reverse_node_mapping(mapping) + if not silence: + content = etree_.tostring( + rootElement, pretty_print=True, + xml_declaration=True, encoding="utf-8") + sys.stdout.write(content) + sys.stdout.write('\n') + return rootObj, rootElement, mapping, reverse_mapping + + +def parseString(inString, silence=False): + if sys.version_info.major == 2: + from StringIO import StringIO as IOBuffer + else: + from io import BytesIO as IOBuffer + parser = None + doc = parsexml_(IOBuffer(inString), parser) + rootNode = doc.getroot() + rootTag, rootClass = get_root_tag(rootNode) + if rootClass is None: + rootTag = 'rootType' + rootClass = rootType + rootObj = rootClass.factory() + rootObj.build(rootNode) + # Enable Python to collect the space used by the DOM. + doc = None + if not silence: + sys.stdout.write('<?xml version="1.0" ?>\n') + rootObj.export( + sys.stdout, 0, name_=rootTag, + namespacedef_='') + return rootObj + + +def parseLiteral(inFileName, silence=False): + parser = None + doc = parsexml_(inFileName, parser) + rootNode = doc.getroot() + rootTag, rootClass = get_root_tag(rootNode) + if rootClass is None: + rootTag = 'rootType' + rootClass = rootType + rootObj = rootClass.factory() + rootObj.build(rootNode) + # Enable Python to collect the space used by the DOM. + doc = None + if not silence: + sys.stdout.write('#from mixedcontent2_sup import *\n\n') + sys.stdout.write('import mixedcontent2_sup as model_\n\n') + sys.stdout.write('rootObj = model_.rootClass(\n') + rootObj.exportLiteral(sys.stdout, 0, name_=rootTag) + sys.stdout.write(')\n') + return rootObj + + +def main(): + args = sys.argv[1:] + if len(args) == 1: + parse(args[0]) + else: + usage() + + +if __name__ == '__main__': + #import pdb; pdb.set_trace() + main() + + +__all__ = [ + "markupType", + "nested1AType", + "nested1Type", + "nestedType", + "rootType" +] diff --git a/tests/mixedcontent2_out.xml b/tests/mixedcontent2_out.xml new file mode 100644 index 0000000000000000000000000000000000000000..844a60c5302dfc9aac29d7a8688888c49f4aea10 --- /dev/null +++ b/tests/mixedcontent2_out.xml @@ -0,0 +1,48 @@ +<?xml version="1.0" ?> +<root> + <markup> +This markup has <embedded>content</embedded> within it. </markup> + <markup> +This markup has element + <nested> + <nested1> + <nestedA1> + <nestedB1>B1 text A</nestedB1> + <nestedB2>B2 text A</nestedB2> + </nestedA1> + <nestedA1> + <nestedB1>B1 text B</nestedB1> + <nestedB2>B2 text B</nestedB2> + </nestedA1> + </nested1> + <nested2>Some nested text</nested2> + <nested3>1234</nested3> + </nested> + + content and character content + <nested> + <nested2>Some nested text</nested2> + <nested3>1234</nested3> + </nested> + + within it. + <nested> + <nested1> + <nestedA1> + <nestedB1>B1 text A</nestedB1> + <nestedB2>B2 text A</nestedB2> + </nestedA1> + <nestedA1> + <nestedB1>B1 text B</nestedB1> + <nestedB2>B2 text B</nestedB2> + </nestedA1> + </nested1> + <nested2>Some nested text</nested2> + <nested3>1234</nested3> + </nested> + <nested> + <nested2>Some nested text</nested2> + <nested3>1234</nested3> + </nested> + </markup> +</root> diff --git a/tests/mixedcontent2_sub.py b/tests/mixedcontent2_sub.py new file mode 100644 index 0000000000000000000000000000000000000000..1302fdc13495ffcbf6b2f1b82e965d77b326489e --- /dev/null +++ b/tests/mixedcontent2_sub.py @@ -0,0 +1,201 @@ +#!/usr/bin/env python + +# +# Generated by generateDS.py. +# Python 2.7.14 (default, Sep 23 2017, 22:06:14) [GCC 7.2.0] +# +# Command line options: +# ('--no-dates', '') +# ('--no-versions', '') +# ('--member-specs', 'list') +# ('-f', '') +# ('-o', 'tests/mixedcontent2_sup.py') +# ('-s', 'tests/mixedcontent2_sub.py') +# ('--super', 'mixedcontent2_sup') +# +# Command line arguments: +# tests/mixedcontent.xsd +# +# Command line: +# generateDS.py --no-dates --no-versions --member-specs="list" -f -o "tests/mixedcontent2_sup.py" -s "tests/mixedcontent2_sub.py" --super="mixedcontent2_sup" tests/mixedcontent.xsd +# +# Current working directory (os.getcwd()): +# generateds +# + +import sys +from lxml import etree as etree_ + +import mixedcontent2_sup as supermod + +def parsexml_(infile, parser=None, **kwargs): + if parser is None: + # Use the lxml ElementTree compatible parser so that, e.g., + # we ignore comments. + parser = etree_.ETCompatXMLParser() + doc = etree_.parse(infile, parser=parser, **kwargs) + return doc + +# +# Globals +# + +ExternalEncoding = 'ascii' + +# +# Data representation classes +# + + +class rootTypeSub(supermod.rootType): + def __init__(self, markup=None): + super(rootTypeSub, self).__init__(markup, ) +supermod.rootType.subclass = rootTypeSub +# end class rootTypeSub + + +class markupTypeSub(supermod.markupType): + def __init__(self, embedded=None, nested=None, valueOf_=None, mixedclass_=None, content_=None): + super(markupTypeSub, self).__init__(embedded, nested, valueOf_, mixedclass_, content_, ) +supermod.markupType.subclass = markupTypeSub +# end class markupTypeSub + + +class nestedTypeSub(supermod.nestedType): + def __init__(self, nested1=None, nested2=None, nested3=None): + super(nestedTypeSub, self).__init__(nested1, nested2, nested3, ) +supermod.nestedType.subclass = nestedTypeSub +# end class nestedTypeSub + + +class nested1TypeSub(supermod.nested1Type): + def __init__(self, nestedA1=None, nestedA2=None): + super(nested1TypeSub, self).__init__(nestedA1, nestedA2, ) +supermod.nested1Type.subclass = nested1TypeSub +# end class nested1TypeSub + + +class nested1ATypeSub(supermod.nested1AType): + def __init__(self, nestedB1=None, nestedB2=None): + super(nested1ATypeSub, self).__init__(nestedB1, nestedB2, ) +supermod.nested1AType.subclass = nested1ATypeSub +# end class nested1ATypeSub + + +def get_root_tag(node): + tag = supermod.Tag_pattern_.match(node.tag).groups()[-1] + rootClass = None + rootClass = supermod.GDSClassesMapping.get(tag) + if rootClass is None and hasattr(supermod, tag): + rootClass = getattr(supermod, tag) + return tag, rootClass + + +def parse(inFilename, silence=False): + parser = None + doc = parsexml_(inFilename, parser) + rootNode = doc.getroot() + rootTag, rootClass = get_root_tag(rootNode) + if rootClass is None: + rootTag = 'rootType' + rootClass = supermod.rootType + rootObj = rootClass.factory() + rootObj.build(rootNode) + # Enable Python to collect the space used by the DOM. + doc = None + if not silence: + sys.stdout.write('<?xml version="1.0" ?>\n') + rootObj.export( + sys.stdout, 0, name_=rootTag, + namespacedef_='', + pretty_print=True) + return rootObj + + +def parseEtree(inFilename, silence=False): + parser = None + doc = parsexml_(inFilename, parser) + rootNode = doc.getroot() + rootTag, rootClass = get_root_tag(rootNode) + if rootClass is None: + rootTag = 'rootType' + rootClass = supermod.rootType + rootObj = rootClass.factory() + rootObj.build(rootNode) + # Enable Python to collect the space used by the DOM. + doc = None + mapping = {} + rootElement = rootObj.to_etree(None, name_=rootTag, mapping_=mapping) + reverse_mapping = rootObj.gds_reverse_node_mapping(mapping) + if not silence: + content = etree_.tostring( + rootElement, pretty_print=True, + xml_declaration=True, encoding="utf-8") + sys.stdout.write(content) + sys.stdout.write('\n') + return rootObj, rootElement, mapping, reverse_mapping + + +def parseString(inString, silence=False): + from StringIO import StringIO + parser = None + doc = parsexml_(StringIO(inString), parser) + rootNode = doc.getroot() + rootTag, rootClass = get_root_tag(rootNode) + if rootClass is None: + rootTag = 'rootType' + rootClass = supermod.rootType + rootObj = rootClass.factory() + rootObj.build(rootNode) + # Enable Python to collect the space used by the DOM. + doc = None + if not silence: + sys.stdout.write('<?xml version="1.0" ?>\n') + rootObj.export( + sys.stdout, 0, name_=rootTag, + namespacedef_='') + return rootObj + + +def parseLiteral(inFilename, silence=False): + parser = None + doc = parsexml_(inFilename, parser) + rootNode = doc.getroot() + rootTag, rootClass = get_root_tag(rootNode) + if rootClass is None: + rootTag = 'rootType' + rootClass = supermod.rootType + rootObj = rootClass.factory() + rootObj.build(rootNode) + # Enable Python to collect the space used by the DOM. + doc = None + if not silence: + sys.stdout.write('#from mixedcontent2_sup import *\n\n') + sys.stdout.write('import mixedcontent2_sup as model_\n\n') + sys.stdout.write('rootObj = model_.rootClass(\n') + rootObj.exportLiteral(sys.stdout, 0, name_=rootTag) + sys.stdout.write(')\n') + return rootObj + + +USAGE_TEXT = """ +Usage: python ???.py <infilename> +""" + + +def usage(): + print(USAGE_TEXT) + sys.exit(1) + + +def main(): + args = sys.argv[1:] + if len(args) != 1: + usage() + infilename = args[0] + parse(infilename) + + +if __name__ == '__main__': + #import pdb; pdb.set_trace() + main() diff --git a/tests/mixedcontent2_sup.py b/tests/mixedcontent2_sup.py new file mode 100644 index 0000000000000000000000000000000000000000..59f9c98fe47f68eacd845e30b426ee52fcfc2a48 --- /dev/null +++ b/tests/mixedcontent2_sup.py @@ -0,0 +1,1385 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +# +# Generated by generateDS.py. +# Python 2.7.14 (default, Sep 23 2017, 22:06:14) [GCC 7.2.0] +# +# Command line options: +# ('--no-dates', '') +# ('--no-versions', '') +# ('--member-specs', 'list') +# ('-f', '') +# ('-o', 'tests/mixedcontent2_sup.py') +# ('-s', 'tests/mixedcontent2_sub.py') +# ('--super', 'mixedcontent2_sup') +# +# Command line arguments: +# tests/mixedcontent.xsd +# +# Command line: +# generateDS.py --no-dates --no-versions --member-specs="list" -f -o "tests/mixedcontent2_sup.py" -s "tests/mixedcontent2_sub.py" --super="mixedcontent2_sup" tests/mixedcontent.xsd +# +# Current working directory (os.getcwd()): +# generateds +# + +import sys +import re as re_ +import base64 +import datetime as datetime_ +import warnings as warnings_ +try: + from lxml import etree as etree_ +except ImportError: + from xml.etree import ElementTree as etree_ + + +Validate_simpletypes_ = True +if sys.version_info.major == 2: + BaseStrType_ = basestring +else: + BaseStrType_ = str + + +def parsexml_(infile, parser=None, **kwargs): + if parser is None: + # Use the lxml ElementTree compatible parser so that, e.g., + # we ignore comments. + try: + parser = etree_.ETCompatXMLParser() + except AttributeError: + # fallback to xml.etree + parser = etree_.XMLParser() + doc = etree_.parse(infile, parser=parser, **kwargs) + return doc + +# +# Namespace prefix definition table (and other attributes, too) +# +# The module generatedsnamespaces, if it is importable, must contain +# a dictionary named GeneratedsNamespaceDefs. This Python dictionary +# should map element type names (strings) to XML schema namespace prefix +# definitions. The export method for any class for which there is +# a namespace prefix definition, will export that definition in the +# XML representation of that element. See the export method of +# any generated element type class for a example of the use of this +# table. +# A sample table is: +# +# # File: generatedsnamespaces.py +# +# GenerateDSNamespaceDefs = { +# "ElementtypeA": "http://www.xxx.com/namespaceA", +# "ElementtypeB": "http://www.xxx.com/namespaceB", +# } +# + +try: + from generatedsnamespaces import GenerateDSNamespaceDefs as GenerateDSNamespaceDefs_ +except ImportError: + GenerateDSNamespaceDefs_ = {} + +# +# The root super-class for element type classes +# +# Calls to the methods in these classes are generated by generateDS.py. +# You can replace these methods by re-implementing the following class +# in a module named generatedssuper.py. + +try: + from generatedssuper import GeneratedsSuper +except ImportError as exp: + + class GeneratedsSuper(object): + tzoff_pattern = re_.compile(r'(\+|-)((0\d|1[0-3]):[0-5]\d|14:00)$') + class _FixedOffsetTZ(datetime_.tzinfo): + def __init__(self, offset, name): + self.__offset = datetime_.timedelta(minutes=offset) + self.__name = name + def utcoffset(self, dt): + return self.__offset + def tzname(self, dt): + return self.__name + def dst(self, dt): + return None + def gds_format_string(self, input_data, input_name=''): + return input_data + def gds_validate_string(self, input_data, node=None, input_name=''): + if not input_data: + return '' + else: + return input_data + def gds_format_base64(self, input_data, input_name=''): + return base64.b64encode(input_data) + def gds_validate_base64(self, input_data, node=None, input_name=''): + return input_data + def gds_format_integer(self, input_data, input_name=''): + return '%d' % input_data + def gds_validate_integer(self, input_data, node=None, input_name=''): + return input_data + def gds_format_integer_list(self, input_data, input_name=''): + return '%s' % ' '.join(input_data) + def gds_validate_integer_list( + self, input_data, node=None, input_name=''): + values = input_data.split() + for value in values: + try: + int(value) + except (TypeError, ValueError): + raise_parse_error(node, 'Requires sequence of integers') + return values + def gds_format_float(self, input_data, input_name=''): + return ('%.15f' % input_data).rstrip('0') + def gds_validate_float(self, input_data, node=None, input_name=''): + return input_data + def gds_format_float_list(self, input_data, input_name=''): + return '%s' % ' '.join(input_data) + def gds_validate_float_list( + self, input_data, node=None, input_name=''): + values = input_data.split() + for value in values: + try: + float(value) + except (TypeError, ValueError): + raise_parse_error(node, 'Requires sequence of floats') + return values + def gds_format_double(self, input_data, input_name=''): + return '%e' % input_data + def gds_validate_double(self, input_data, node=None, input_name=''): + return input_data + def gds_format_double_list(self, input_data, input_name=''): + return '%s' % ' '.join(input_data) + def gds_validate_double_list( + self, input_data, node=None, input_name=''): + values = input_data.split() + for value in values: + try: + float(value) + except (TypeError, ValueError): + raise_parse_error(node, 'Requires sequence of doubles') + return values + def gds_format_boolean(self, input_data, input_name=''): + return ('%s' % input_data).lower() + def gds_validate_boolean(self, input_data, node=None, input_name=''): + return input_data + def gds_format_boolean_list(self, input_data, input_name=''): + return '%s' % ' '.join(input_data) + def gds_validate_boolean_list( + self, input_data, node=None, input_name=''): + values = input_data.split() + for value in values: + if value not in ('true', '1', 'false', '0', ): + raise_parse_error( + node, + 'Requires sequence of booleans ' + '("true", "1", "false", "0")') + return values + def gds_validate_datetime(self, input_data, node=None, input_name=''): + return input_data + def gds_format_datetime(self, input_data, input_name=''): + if input_data.microsecond == 0: + _svalue = '%04d-%02d-%02dT%02d:%02d:%02d' % ( + input_data.year, + input_data.month, + input_data.day, + input_data.hour, + input_data.minute, + input_data.second, + ) + else: + _svalue = '%04d-%02d-%02dT%02d:%02d:%02d.%s' % ( + input_data.year, + input_data.month, + input_data.day, + input_data.hour, + input_data.minute, + input_data.second, + ('%f' % (float(input_data.microsecond) / 1000000))[2:], + ) + if input_data.tzinfo is not None: + tzoff = input_data.tzinfo.utcoffset(input_data) + if tzoff is not None: + total_seconds = tzoff.seconds + (86400 * tzoff.days) + if total_seconds == 0: + _svalue += 'Z' + else: + if total_seconds < 0: + _svalue += '-' + total_seconds *= -1 + else: + _svalue += '+' + hours = total_seconds // 3600 + minutes = (total_seconds - (hours * 3600)) // 60 + _svalue += '{0:02d}:{1:02d}'.format(hours, minutes) + return _svalue + @classmethod + def gds_parse_datetime(cls, input_data): + tz = None + if input_data[-1] == 'Z': + tz = GeneratedsSuper._FixedOffsetTZ(0, 'UTC') + input_data = input_data[:-1] + else: + results = GeneratedsSuper.tzoff_pattern.search(input_data) + if results is not None: + tzoff_parts = results.group(2).split(':') + tzoff = int(tzoff_parts[0]) * 60 + int(tzoff_parts[1]) + if results.group(1) == '-': + tzoff *= -1 + tz = GeneratedsSuper._FixedOffsetTZ( + tzoff, results.group(0)) + input_data = input_data[:-6] + time_parts = input_data.split('.') + if len(time_parts) > 1: + micro_seconds = int(float('0.' + time_parts[1]) * 1000000) + input_data = '%s.%s' % (time_parts[0], micro_seconds, ) + dt = datetime_.datetime.strptime( + input_data, '%Y-%m-%dT%H:%M:%S.%f') + else: + dt = datetime_.datetime.strptime( + input_data, '%Y-%m-%dT%H:%M:%S') + dt = dt.replace(tzinfo=tz) + return dt + def gds_validate_date(self, input_data, node=None, input_name=''): + return input_data + def gds_format_date(self, input_data, input_name=''): + _svalue = '%04d-%02d-%02d' % ( + input_data.year, + input_data.month, + input_data.day, + ) + try: + if input_data.tzinfo is not None: + tzoff = input_data.tzinfo.utcoffset(input_data) + if tzoff is not None: + total_seconds = tzoff.seconds + (86400 * tzoff.days) + if total_seconds == 0: + _svalue += 'Z' + else: + if total_seconds < 0: + _svalue += '-' + total_seconds *= -1 + else: + _svalue += '+' + hours = total_seconds // 3600 + minutes = (total_seconds - (hours * 3600)) // 60 + _svalue += '{0:02d}:{1:02d}'.format( + hours, minutes) + except AttributeError: + pass + return _svalue + @classmethod + def gds_parse_date(cls, input_data): + tz = None + if input_data[-1] == 'Z': + tz = GeneratedsSuper._FixedOffsetTZ(0, 'UTC') + input_data = input_data[:-1] + else: + results = GeneratedsSuper.tzoff_pattern.search(input_data) + if results is not None: + tzoff_parts = results.group(2).split(':') + tzoff = int(tzoff_parts[0]) * 60 + int(tzoff_parts[1]) + if results.group(1) == '-': + tzoff *= -1 + tz = GeneratedsSuper._FixedOffsetTZ( + tzoff, results.group(0)) + input_data = input_data[:-6] + dt = datetime_.datetime.strptime(input_data, '%Y-%m-%d') + dt = dt.replace(tzinfo=tz) + return dt.date() + def gds_validate_time(self, input_data, node=None, input_name=''): + return input_data + def gds_format_time(self, input_data, input_name=''): + if input_data.microsecond == 0: + _svalue = '%02d:%02d:%02d' % ( + input_data.hour, + input_data.minute, + input_data.second, + ) + else: + _svalue = '%02d:%02d:%02d.%s' % ( + input_data.hour, + input_data.minute, + input_data.second, + ('%f' % (float(input_data.microsecond) / 1000000))[2:], + ) + if input_data.tzinfo is not None: + tzoff = input_data.tzinfo.utcoffset(input_data) + if tzoff is not None: + total_seconds = tzoff.seconds + (86400 * tzoff.days) + if total_seconds == 0: + _svalue += 'Z' + else: + if total_seconds < 0: + _svalue += '-' + total_seconds *= -1 + else: + _svalue += '+' + hours = total_seconds // 3600 + minutes = (total_seconds - (hours * 3600)) // 60 + _svalue += '{0:02d}:{1:02d}'.format(hours, minutes) + return _svalue + def gds_validate_simple_patterns(self, patterns, target): + # pat is a list of lists of strings/patterns. We should: + # - AND the outer elements + # - OR the inner elements + found1 = True + for patterns1 in patterns: + found2 = False + for patterns2 in patterns1: + if re_.search(patterns2, target) is not None: + found2 = True + break + if not found2: + found1 = False + break + return found1 + @classmethod + def gds_parse_time(cls, input_data): + tz = None + if input_data[-1] == 'Z': + tz = GeneratedsSuper._FixedOffsetTZ(0, 'UTC') + input_data = input_data[:-1] + else: + results = GeneratedsSuper.tzoff_pattern.search(input_data) + if results is not None: + tzoff_parts = results.group(2).split(':') + tzoff = int(tzoff_parts[0]) * 60 + int(tzoff_parts[1]) + if results.group(1) == '-': + tzoff *= -1 + tz = GeneratedsSuper._FixedOffsetTZ( + tzoff, results.group(0)) + input_data = input_data[:-6] + if len(input_data.split('.')) > 1: + dt = datetime_.datetime.strptime(input_data, '%H:%M:%S.%f') + else: + dt = datetime_.datetime.strptime(input_data, '%H:%M:%S') + dt = dt.replace(tzinfo=tz) + return dt.time() + def gds_str_lower(self, instring): + return instring.lower() + def get_path_(self, node): + path_list = [] + self.get_path_list_(node, path_list) + path_list.reverse() + path = '/'.join(path_list) + return path + Tag_strip_pattern_ = re_.compile(r'\{.*\}') + def get_path_list_(self, node, path_list): + if node is None: + return + tag = GeneratedsSuper.Tag_strip_pattern_.sub('', node.tag) + if tag: + path_list.append(tag) + self.get_path_list_(node.getparent(), path_list) + def get_class_obj_(self, node, default_class=None): + class_obj1 = default_class + if 'xsi' in node.nsmap: + classname = node.get('{%s}type' % node.nsmap['xsi']) + if classname is not None: + names = classname.split(':') + if len(names) == 2: + classname = names[1] + class_obj2 = globals().get(classname) + if class_obj2 is not None: + class_obj1 = class_obj2 + return class_obj1 + def gds_build_any(self, node, type_name=None): + return None + @classmethod + def gds_reverse_node_mapping(cls, mapping): + return dict(((v, k) for k, v in mapping.iteritems())) + @staticmethod + def gds_encode(instring): + if sys.version_info.major == 2: + return instring.encode(ExternalEncoding) + else: + return instring + @staticmethod + def convert_unicode(instring): + if isinstance(instring, str): + result = quote_xml(instring) + elif sys.version_info.major == 2 and isinstance(instring, unicode): + result = quote_xml(instring).encode('utf8') + else: + result = GeneratedsSuper.gds_encode(str(instring)) + return result + def __eq__(self, other): + if type(self) != type(other): + return False + return self.__dict__ == other.__dict__ + def __ne__(self, other): + return not self.__eq__(other) + + def getSubclassFromModule_(module, class_): + '''Get the subclass of a class from a specific module.''' + name = class_.__name__ + 'Sub' + if hasattr(module, name): + return getattr(module, name) + else: + return None + + +# +# If you have installed IPython you can uncomment and use the following. +# IPython is available from http://ipython.scipy.org/. +# + +## from IPython.Shell import IPShellEmbed +## args = '' +## ipshell = IPShellEmbed(args, +## banner = 'Dropping into IPython', +## exit_msg = 'Leaving Interpreter, back to program.') + +# Then use the following line where and when you want to drop into the +# IPython shell: +# ipshell('<some message> -- Entering ipshell.\nHit Ctrl-D to exit') + +# +# Globals +# + +ExternalEncoding = 'ascii' +Tag_pattern_ = re_.compile(r'({.*})?(.*)') +String_cleanup_pat_ = re_.compile(r"[\n\r\s]+") +Namespace_extract_pat_ = re_.compile(r'{(.*)}(.*)') +CDATA_pattern_ = re_.compile(r"<!\[CDATA\[.*?\]\]>", re_.DOTALL) + +# Change this to redirect the generated superclass module to use a +# specific subclass module. +CurrentSubclassModule_ = None + +# +# Support/utility functions. +# + + +def showIndent(outfile, level, pretty_print=True): + if pretty_print: + for idx in range(level): + outfile.write(' ') + + +def quote_xml(inStr): + "Escape markup chars, but do not modify CDATA sections." + if not inStr: + return '' + s1 = (isinstance(inStr, BaseStrType_) and inStr or '%s' % inStr) + s2 = '' + pos = 0 + matchobjects = CDATA_pattern_.finditer(s1) + for mo in matchobjects: + s3 = s1[pos:mo.start()] + s2 += quote_xml_aux(s3) + s2 += s1[mo.start():mo.end()] + pos = mo.end() + s3 = s1[pos:] + s2 += quote_xml_aux(s3) + return s2 + + +def quote_xml_aux(inStr): + s1 = inStr.replace('&', '&') + s1 = s1.replace('<', '<') + s1 = s1.replace('>', '>') + return s1 + + +def quote_attrib(inStr): + s1 = (isinstance(inStr, BaseStrType_) and inStr or '%s' % inStr) + s1 = s1.replace('&', '&') + s1 = s1.replace('<', '<') + s1 = s1.replace('>', '>') + if '"' in s1: + if "'" in s1: + s1 = '"%s"' % s1.replace('"', """) + else: + s1 = "'%s'" % s1 + else: + s1 = '"%s"' % s1 + return s1 + + +def quote_python(inStr): + s1 = inStr + if s1.find("'") == -1: + if s1.find('\n') == -1: + return "'%s'" % s1 + else: + return "'''%s'''" % s1 + else: + if s1.find('"') != -1: + s1 = s1.replace('"', '\\"') + if s1.find('\n') == -1: + return '"%s"' % s1 + else: + return '"""%s"""' % s1 + + +def get_all_text_(node): + if node.text is not None: + text = node.text + else: + text = '' + for child in node: + if child.tail is not None: + text += child.tail + return text + + +def find_attr_value_(attr_name, node): + attrs = node.attrib + attr_parts = attr_name.split(':') + value = None + if len(attr_parts) == 1: + value = attrs.get(attr_name) + elif len(attr_parts) == 2: + prefix, name = attr_parts + namespace = node.nsmap.get(prefix) + if namespace is not None: + value = attrs.get('{%s}%s' % (namespace, name, )) + return value + + +class GDSParseError(Exception): + pass + + +def raise_parse_error(node, msg): + msg = '%s (element %s/line %d)' % (msg, node.tag, node.sourceline, ) + raise GDSParseError(msg) + + +class MixedContainer: + # Constants for category: + CategoryNone = 0 + CategoryText = 1 + CategorySimple = 2 + CategoryComplex = 3 + # Constants for content_type: + TypeNone = 0 + TypeText = 1 + TypeString = 2 + TypeInteger = 3 + TypeFloat = 4 + TypeDecimal = 5 + TypeDouble = 6 + TypeBoolean = 7 + TypeBase64 = 8 + def __init__(self, category, content_type, name, value): + self.category = category + self.content_type = content_type + self.name = name + self.value = value + def getCategory(self): + return self.category + def getContenttype(self, content_type): + return self.content_type + def getValue(self): + return self.value + def getName(self): + return self.name + def export(self, outfile, level, name, namespace, + pretty_print=True): + if self.category == MixedContainer.CategoryText: + # Prevent exporting empty content as empty lines. + if self.value.strip(): + outfile.write(self.value) + elif self.category == MixedContainer.CategorySimple: + self.exportSimple(outfile, level, name) + else: # category == MixedContainer.CategoryComplex + self.value.export( + outfile, level, namespace, name, + pretty_print=pretty_print) + def exportSimple(self, outfile, level, name): + if self.content_type == MixedContainer.TypeString: + outfile.write('<%s>%s</%s>' % ( + self.name, self.value, self.name)) + elif self.content_type == MixedContainer.TypeInteger or \ + self.content_type == MixedContainer.TypeBoolean: + outfile.write('<%s>%d</%s>' % ( + self.name, self.value, self.name)) + elif self.content_type == MixedContainer.TypeFloat or \ + self.content_type == MixedContainer.TypeDecimal: + outfile.write('<%s>%f</%s>' % ( + self.name, self.value, self.name)) + elif self.content_type == MixedContainer.TypeDouble: + outfile.write('<%s>%g</%s>' % ( + self.name, self.value, self.name)) + elif self.content_type == MixedContainer.TypeBase64: + outfile.write('<%s>%s</%s>' % ( + self.name, + base64.b64encode(self.value), + self.name)) + def to_etree(self, element): + if self.category == MixedContainer.CategoryText: + # Prevent exporting empty content as empty lines. + if self.value.strip(): + if len(element) > 0: + if element[-1].tail is None: + element[-1].tail = self.value + else: + element[-1].tail += self.value + else: + if element.text is None: + element.text = self.value + else: + element.text += self.value + elif self.category == MixedContainer.CategorySimple: + subelement = etree_.SubElement( + element, '%s' % self.name) + subelement.text = self.to_etree_simple() + else: # category == MixedContainer.CategoryComplex + self.value.to_etree(element) + def to_etree_simple(self): + if self.content_type == MixedContainer.TypeString: + text = self.value + elif (self.content_type == MixedContainer.TypeInteger or + self.content_type == MixedContainer.TypeBoolean): + text = '%d' % self.value + elif (self.content_type == MixedContainer.TypeFloat or + self.content_type == MixedContainer.TypeDecimal): + text = '%f' % self.value + elif self.content_type == MixedContainer.TypeDouble: + text = '%g' % self.value + elif self.content_type == MixedContainer.TypeBase64: + text = '%s' % base64.b64encode(self.value) + return text + def exportLiteral(self, outfile, level, name): + if self.category == MixedContainer.CategoryText: + showIndent(outfile, level) + outfile.write( + 'model_.MixedContainer(%d, %d, "%s", "%s"),\n' % ( + self.category, self.content_type, + self.name, self.value)) + elif self.category == MixedContainer.CategorySimple: + showIndent(outfile, level) + outfile.write( + 'model_.MixedContainer(%d, %d, "%s", "%s"),\n' % ( + self.category, self.content_type, + self.name, self.value)) + else: # category == MixedContainer.CategoryComplex + showIndent(outfile, level) + outfile.write( + 'model_.MixedContainer(%d, %d, "%s",\n' % ( + self.category, self.content_type, self.name,)) + self.value.exportLiteral(outfile, level + 1) + showIndent(outfile, level) + outfile.write(')\n') + + +class MemberSpec_(object): + def __init__(self, name='', data_type='', container=0, + optional=0, child_attrs=None, choice=None): + self.name = name + self.data_type = data_type + self.container = container + self.child_attrs = child_attrs + self.choice = choice + self.optional = optional + def set_name(self, name): self.name = name + def get_name(self): return self.name + def set_data_type(self, data_type): self.data_type = data_type + def get_data_type_chain(self): return self.data_type + def get_data_type(self): + if isinstance(self.data_type, list): + if len(self.data_type) > 0: + return self.data_type[-1] + else: + return 'xs:string' + else: + return self.data_type + def set_container(self, container): self.container = container + def get_container(self): return self.container + def set_child_attrs(self, child_attrs): self.child_attrs = child_attrs + def get_child_attrs(self): return self.child_attrs + def set_choice(self, choice): self.choice = choice + def get_choice(self): return self.choice + def set_optional(self, optional): self.optional = optional + def get_optional(self): return self.optional + + +def _cast(typ, value): + if typ is None or value is None: + return value + return typ(value) + +# +# Data representation classes. +# + + +class rootType(GeneratedsSuper): + member_data_items_ = [ + MemberSpec_('markup', 'markupType', 1, 0, {u'maxOccurs': u'unbounded', u'type': u'markupType', u'name': u'markup'}, None), + ] + subclass = None + superclass = None + def __init__(self, markup=None): + self.original_tagname_ = None + if markup is None: + self.markup = [] + else: + self.markup = markup + def factory(*args_, **kwargs_): + if CurrentSubclassModule_ is not None: + subclass = getSubclassFromModule_( + CurrentSubclassModule_, rootType) + if subclass is not None: + return subclass(*args_, **kwargs_) + if rootType.subclass: + return rootType.subclass(*args_, **kwargs_) + else: + return rootType(*args_, **kwargs_) + factory = staticmethod(factory) + def get_markup(self): return self.markup + def set_markup(self, markup): self.markup = markup + def add_markup(self, value): self.markup.append(value) + def insert_markup_at(self, index, value): self.markup.insert(index, value) + def replace_markup_at(self, index, value): self.markup[index] = value + def hasContent_(self): + if ( + self.markup + ): + return True + else: + return False + def export(self, outfile, level, namespace_='', name_='rootType', namespacedef_='', pretty_print=True): + imported_ns_def_ = GenerateDSNamespaceDefs_.get('rootType') + if imported_ns_def_ is not None: + namespacedef_ = imported_ns_def_ + if pretty_print: + eol_ = '\n' + else: + eol_ = '' + if self.original_tagname_ is not None: + name_ = self.original_tagname_ + showIndent(outfile, level, pretty_print) + outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) + already_processed = set() + self.exportAttributes(outfile, level, already_processed, namespace_, name_='rootType') + if self.hasContent_(): + outfile.write('>%s' % (eol_, )) + self.exportChildren(outfile, level + 1, namespace_='', name_='rootType', pretty_print=pretty_print) + showIndent(outfile, level, pretty_print) + outfile.write('</%s%s>%s' % (namespace_, name_, eol_)) + else: + outfile.write('/>%s' % (eol_, )) + def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='rootType'): + pass + def exportChildren(self, outfile, level, namespace_='', name_='rootType', fromsubclass_=False, pretty_print=True): + if pretty_print: + eol_ = '\n' + else: + eol_ = '' + for markup_ in self.markup: + markup_.export(outfile, level, namespace_, name_='markup', pretty_print=pretty_print) + def build(self, node): + already_processed = set() + self.buildAttributes(node, node.attrib, already_processed) + for child in node: + nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] + self.buildChildren(child, node, nodeName_) + return self + def buildAttributes(self, node, attrs, already_processed): + pass + def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): + if nodeName_ == 'markup': + obj_ = markupType.factory() + obj_.build(child_) + self.markup.append(obj_) + obj_.original_tagname_ = 'markup' +# end class rootType + + +class markupType(GeneratedsSuper): + member_data_items_ = [ + MemberSpec_('embedded', 'xs:string', 1, 1, {u'maxOccurs': u'unbounded', u'type': u'xs:string', u'name': u'embedded', u'minOccurs': u'0'}, None), + MemberSpec_('nested', 'nestedType', 1, 1, {u'maxOccurs': u'unbounded', u'type': u'nestedType', u'name': u'nested', u'minOccurs': u'0'}, None), + MemberSpec_('valueOf_', [], 0), + ] + subclass = None + superclass = None + def __init__(self, embedded=None, nested=None, valueOf_=None, mixedclass_=None, content_=None): + self.original_tagname_ = None + if embedded is None: + self.embedded = [] + else: + self.embedded = embedded + if nested is None: + self.nested = [] + else: + self.nested = nested + self.valueOf_ = valueOf_ + if mixedclass_ is None: + self.mixedclass_ = MixedContainer + else: + self.mixedclass_ = mixedclass_ + if content_ is None: + self.content_ = [] + else: + self.content_ = content_ + self.valueOf_ = valueOf_ + def factory(*args_, **kwargs_): + if CurrentSubclassModule_ is not None: + subclass = getSubclassFromModule_( + CurrentSubclassModule_, markupType) + if subclass is not None: + return subclass(*args_, **kwargs_) + if markupType.subclass: + return markupType.subclass(*args_, **kwargs_) + else: + return markupType(*args_, **kwargs_) + factory = staticmethod(factory) + def get_embedded(self): return self.embedded + def set_embedded(self, embedded): self.embedded = embedded + def add_embedded(self, value): self.embedded.append(value) + def insert_embedded_at(self, index, value): self.embedded.insert(index, value) + def replace_embedded_at(self, index, value): self.embedded[index] = value + def get_nested(self): return self.nested + def set_nested(self, nested): self.nested = nested + def add_nested(self, value): self.nested.append(value) + def insert_nested_at(self, index, value): self.nested.insert(index, value) + def replace_nested_at(self, index, value): self.nested[index] = value + def get_valueOf_(self): return self.valueOf_ + def set_valueOf_(self, valueOf_): self.valueOf_ = valueOf_ + def hasContent_(self): + if ( + self.embedded or + self.nested or + (1 if type(self.valueOf_) in [int,float] else self.valueOf_) + ): + return True + else: + return False + def export(self, outfile, level, namespace_='', name_='markupType', namespacedef_='', pretty_print=True): + imported_ns_def_ = GenerateDSNamespaceDefs_.get('markupType') + if imported_ns_def_ is not None: + namespacedef_ = imported_ns_def_ + if pretty_print: + eol_ = '\n' + else: + eol_ = '' + if self.original_tagname_ is not None: + name_ = self.original_tagname_ + showIndent(outfile, level, pretty_print) + outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) + already_processed = set() + self.exportAttributes(outfile, level, already_processed, namespace_, name_='markupType') + if self.hasContent_(): + outfile.write('>%s' % (eol_, )) + self.exportChildren(outfile, level + 1, namespace_='', name_='markupType', pretty_print=pretty_print) + showIndent(outfile, level, pretty_print) + outfile.write('</%s%s>%s' % (namespace_, name_, eol_)) + else: + outfile.write('/>%s' % (eol_, )) + def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='markupType'): + pass + def exportChildren(self, outfile, level, namespace_='', name_='markupType', fromsubclass_=False, pretty_print=True): + if not fromsubclass_: + for item_ in self.content_: + item_.export(outfile, level, item_.name, namespace_, pretty_print=pretty_print) + if pretty_print: + eol_ = '\n' + else: + eol_ = '' + for embedded_ in self.embedded: + showIndent(outfile, level, pretty_print) + outfile.write('<embedded>%s</embedded>%s' % (self.gds_encode(self.gds_format_string(quote_xml(embedded_), input_name='embedded')), eol_)) + for nested_ in self.nested: + nested_.export(outfile, level, namespace_, name_='nested', pretty_print=pretty_print) + def build(self, node): + already_processed = set() + self.buildAttributes(node, node.attrib, already_processed) + self.valueOf_ = get_all_text_(node) + if node.text is not None: + obj_ = self.mixedclass_(MixedContainer.CategoryText, + MixedContainer.TypeNone, '', node.text) + self.content_.append(obj_) + for child in node: + nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] + self.buildChildren(child, node, nodeName_) + return self + def buildAttributes(self, node, attrs, already_processed): + pass + def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): + if nodeName_ == 'embedded' and child_.text is not None: + valuestr_ = child_.text + obj_ = self.mixedclass_(MixedContainer.CategorySimple, + MixedContainer.TypeString, 'embedded', valuestr_) + self.content_.append(obj_) + elif nodeName_ == 'nested': + obj_ = nestedType.factory() + obj_.build(child_) + obj_ = self.mixedclass_(MixedContainer.CategoryComplex, + MixedContainer.TypeNone, 'nested', obj_) + self.content_.append(obj_) + if hasattr(self, 'add_nested'): + self.add_nested(obj_.value) + elif hasattr(self, 'set_nested'): + self.set_nested(obj_.value) + if not fromsubclass_ and child_.tail is not None: + obj_ = self.mixedclass_(MixedContainer.CategoryText, + MixedContainer.TypeNone, '', child_.tail) + self.content_.append(obj_) +# end class markupType + + +class nestedType(GeneratedsSuper): + member_data_items_ = [ + MemberSpec_('nested1', 'nested1Type', 1, 1, {u'maxOccurs': u'unbounded', u'type': u'nested1Type', u'name': u'nested1', u'minOccurs': u'0'}, None), + MemberSpec_('nested2', 'xs:string', 1, 1, {u'maxOccurs': u'unbounded', u'type': u'xs:string', u'name': u'nested2', u'minOccurs': u'0'}, None), + MemberSpec_('nested3', 'xs:integer', 1, 1, {u'maxOccurs': u'unbounded', u'type': u'xs:integer', u'name': u'nested3', u'minOccurs': u'0'}, None), + ] + subclass = None + superclass = None + def __init__(self, nested1=None, nested2=None, nested3=None): + self.original_tagname_ = None + if nested1 is None: + self.nested1 = [] + else: + self.nested1 = nested1 + if nested2 is None: + self.nested2 = [] + else: + self.nested2 = nested2 + if nested3 is None: + self.nested3 = [] + else: + self.nested3 = nested3 + def factory(*args_, **kwargs_): + if CurrentSubclassModule_ is not None: + subclass = getSubclassFromModule_( + CurrentSubclassModule_, nestedType) + if subclass is not None: + return subclass(*args_, **kwargs_) + if nestedType.subclass: + return nestedType.subclass(*args_, **kwargs_) + else: + return nestedType(*args_, **kwargs_) + factory = staticmethod(factory) + def get_nested1(self): return self.nested1 + def set_nested1(self, nested1): self.nested1 = nested1 + def add_nested1(self, value): self.nested1.append(value) + def insert_nested1_at(self, index, value): self.nested1.insert(index, value) + def replace_nested1_at(self, index, value): self.nested1[index] = value + def get_nested2(self): return self.nested2 + def set_nested2(self, nested2): self.nested2 = nested2 + def add_nested2(self, value): self.nested2.append(value) + def insert_nested2_at(self, index, value): self.nested2.insert(index, value) + def replace_nested2_at(self, index, value): self.nested2[index] = value + def get_nested3(self): return self.nested3 + def set_nested3(self, nested3): self.nested3 = nested3 + def add_nested3(self, value): self.nested3.append(value) + def insert_nested3_at(self, index, value): self.nested3.insert(index, value) + def replace_nested3_at(self, index, value): self.nested3[index] = value + def hasContent_(self): + if ( + self.nested1 or + self.nested2 or + self.nested3 + ): + return True + else: + return False + def export(self, outfile, level, namespace_='', name_='nestedType', namespacedef_='', pretty_print=True): + imported_ns_def_ = GenerateDSNamespaceDefs_.get('nestedType') + if imported_ns_def_ is not None: + namespacedef_ = imported_ns_def_ + if pretty_print: + eol_ = '\n' + else: + eol_ = '' + if self.original_tagname_ is not None: + name_ = self.original_tagname_ + showIndent(outfile, level, pretty_print) + outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) + already_processed = set() + self.exportAttributes(outfile, level, already_processed, namespace_, name_='nestedType') + if self.hasContent_(): + outfile.write('>%s' % (eol_, )) + self.exportChildren(outfile, level + 1, namespace_='', name_='nestedType', pretty_print=pretty_print) + showIndent(outfile, level, pretty_print) + outfile.write('</%s%s>%s' % (namespace_, name_, eol_)) + else: + outfile.write('/>%s' % (eol_, )) + def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='nestedType'): + pass + def exportChildren(self, outfile, level, namespace_='', name_='nestedType', fromsubclass_=False, pretty_print=True): + if pretty_print: + eol_ = '\n' + else: + eol_ = '' + for nested1_ in self.nested1: + nested1_.export(outfile, level, namespace_, name_='nested1', pretty_print=pretty_print) + for nested2_ in self.nested2: + showIndent(outfile, level, pretty_print) + outfile.write('<nested2>%s</nested2>%s' % (self.gds_encode(self.gds_format_string(quote_xml(nested2_), input_name='nested2')), eol_)) + for nested3_ in self.nested3: + showIndent(outfile, level, pretty_print) + outfile.write('<nested3>%s</nested3>%s' % (self.gds_format_integer(nested3_, input_name='nested3'), eol_)) + def build(self, node): + already_processed = set() + self.buildAttributes(node, node.attrib, already_processed) + for child in node: + nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] + self.buildChildren(child, node, nodeName_) + return self + def buildAttributes(self, node, attrs, already_processed): + pass + def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): + if nodeName_ == 'nested1': + obj_ = nested1Type.factory() + obj_.build(child_) + self.nested1.append(obj_) + obj_.original_tagname_ = 'nested1' + elif nodeName_ == 'nested2': + nested2_ = child_.text + nested2_ = self.gds_validate_string(nested2_, node, 'nested2') + self.nested2.append(nested2_) + elif nodeName_ == 'nested3': + sval_ = child_.text + try: + ival_ = int(sval_) + except (TypeError, ValueError) as exp: + raise_parse_error(child_, 'requires integer: %s' % exp) + ival_ = self.gds_validate_integer(ival_, node, 'nested3') + self.nested3.append(ival_) +# end class nestedType + + +class nested1Type(GeneratedsSuper): + member_data_items_ = [ + MemberSpec_('nestedA1', 'nested1AType', 1, 1, {u'maxOccurs': u'unbounded', u'type': u'nested1AType', u'name': u'nestedA1', u'minOccurs': u'0'}, None), + MemberSpec_('nestedA2', 'nested1AType', 1, 1, {u'maxOccurs': u'unbounded', u'type': u'nested1AType', u'name': u'nestedA2', u'minOccurs': u'0'}, None), + ] + subclass = None + superclass = None + def __init__(self, nestedA1=None, nestedA2=None): + self.original_tagname_ = None + if nestedA1 is None: + self.nestedA1 = [] + else: + self.nestedA1 = nestedA1 + if nestedA2 is None: + self.nestedA2 = [] + else: + self.nestedA2 = nestedA2 + def factory(*args_, **kwargs_): + if CurrentSubclassModule_ is not None: + subclass = getSubclassFromModule_( + CurrentSubclassModule_, nested1Type) + if subclass is not None: + return subclass(*args_, **kwargs_) + if nested1Type.subclass: + return nested1Type.subclass(*args_, **kwargs_) + else: + return nested1Type(*args_, **kwargs_) + factory = staticmethod(factory) + def get_nestedA1(self): return self.nestedA1 + def set_nestedA1(self, nestedA1): self.nestedA1 = nestedA1 + def add_nestedA1(self, value): self.nestedA1.append(value) + def insert_nestedA1_at(self, index, value): self.nestedA1.insert(index, value) + def replace_nestedA1_at(self, index, value): self.nestedA1[index] = value + def get_nestedA2(self): return self.nestedA2 + def set_nestedA2(self, nestedA2): self.nestedA2 = nestedA2 + def add_nestedA2(self, value): self.nestedA2.append(value) + def insert_nestedA2_at(self, index, value): self.nestedA2.insert(index, value) + def replace_nestedA2_at(self, index, value): self.nestedA2[index] = value + def hasContent_(self): + if ( + self.nestedA1 or + self.nestedA2 + ): + return True + else: + return False + def export(self, outfile, level, namespace_='', name_='nested1Type', namespacedef_='', pretty_print=True): + imported_ns_def_ = GenerateDSNamespaceDefs_.get('nested1Type') + if imported_ns_def_ is not None: + namespacedef_ = imported_ns_def_ + if pretty_print: + eol_ = '\n' + else: + eol_ = '' + if self.original_tagname_ is not None: + name_ = self.original_tagname_ + showIndent(outfile, level, pretty_print) + outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) + already_processed = set() + self.exportAttributes(outfile, level, already_processed, namespace_, name_='nested1Type') + if self.hasContent_(): + outfile.write('>%s' % (eol_, )) + self.exportChildren(outfile, level + 1, namespace_='', name_='nested1Type', pretty_print=pretty_print) + showIndent(outfile, level, pretty_print) + outfile.write('</%s%s>%s' % (namespace_, name_, eol_)) + else: + outfile.write('/>%s' % (eol_, )) + def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='nested1Type'): + pass + def exportChildren(self, outfile, level, namespace_='', name_='nested1Type', fromsubclass_=False, pretty_print=True): + if pretty_print: + eol_ = '\n' + else: + eol_ = '' + for nestedA1_ in self.nestedA1: + nestedA1_.export(outfile, level, namespace_, name_='nestedA1', pretty_print=pretty_print) + for nestedA2_ in self.nestedA2: + nestedA2_.export(outfile, level, namespace_, name_='nestedA2', pretty_print=pretty_print) + def build(self, node): + already_processed = set() + self.buildAttributes(node, node.attrib, already_processed) + for child in node: + nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] + self.buildChildren(child, node, nodeName_) + return self + def buildAttributes(self, node, attrs, already_processed): + pass + def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): + if nodeName_ == 'nestedA1': + obj_ = nested1AType.factory() + obj_.build(child_) + self.nestedA1.append(obj_) + obj_.original_tagname_ = 'nestedA1' + elif nodeName_ == 'nestedA2': + obj_ = nested1AType.factory() + obj_.build(child_) + self.nestedA2.append(obj_) + obj_.original_tagname_ = 'nestedA2' +# end class nested1Type + + +class nested1AType(GeneratedsSuper): + member_data_items_ = [ + MemberSpec_('nestedB1', 'xs:string', 1, 0, {u'maxOccurs': u'unbounded', u'type': u'xs:string', u'name': u'nestedB1'}, None), + MemberSpec_('nestedB2', 'xs:string', 1, 0, {u'maxOccurs': u'unbounded', u'type': u'xs:string', u'name': u'nestedB2'}, None), + ] + subclass = None + superclass = None + def __init__(self, nestedB1=None, nestedB2=None): + self.original_tagname_ = None + if nestedB1 is None: + self.nestedB1 = [] + else: + self.nestedB1 = nestedB1 + if nestedB2 is None: + self.nestedB2 = [] + else: + self.nestedB2 = nestedB2 + def factory(*args_, **kwargs_): + if CurrentSubclassModule_ is not None: + subclass = getSubclassFromModule_( + CurrentSubclassModule_, nested1AType) + if subclass is not None: + return subclass(*args_, **kwargs_) + if nested1AType.subclass: + return nested1AType.subclass(*args_, **kwargs_) + else: + return nested1AType(*args_, **kwargs_) + factory = staticmethod(factory) + def get_nestedB1(self): return self.nestedB1 + def set_nestedB1(self, nestedB1): self.nestedB1 = nestedB1 + def add_nestedB1(self, value): self.nestedB1.append(value) + def insert_nestedB1_at(self, index, value): self.nestedB1.insert(index, value) + def replace_nestedB1_at(self, index, value): self.nestedB1[index] = value + def get_nestedB2(self): return self.nestedB2 + def set_nestedB2(self, nestedB2): self.nestedB2 = nestedB2 + def add_nestedB2(self, value): self.nestedB2.append(value) + def insert_nestedB2_at(self, index, value): self.nestedB2.insert(index, value) + def replace_nestedB2_at(self, index, value): self.nestedB2[index] = value + def hasContent_(self): + if ( + self.nestedB1 or + self.nestedB2 + ): + return True + else: + return False + def export(self, outfile, level, namespace_='', name_='nested1AType', namespacedef_='', pretty_print=True): + imported_ns_def_ = GenerateDSNamespaceDefs_.get('nested1AType') + if imported_ns_def_ is not None: + namespacedef_ = imported_ns_def_ + if pretty_print: + eol_ = '\n' + else: + eol_ = '' + if self.original_tagname_ is not None: + name_ = self.original_tagname_ + showIndent(outfile, level, pretty_print) + outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) + already_processed = set() + self.exportAttributes(outfile, level, already_processed, namespace_, name_='nested1AType') + if self.hasContent_(): + outfile.write('>%s' % (eol_, )) + self.exportChildren(outfile, level + 1, namespace_='', name_='nested1AType', pretty_print=pretty_print) + showIndent(outfile, level, pretty_print) + outfile.write('</%s%s>%s' % (namespace_, name_, eol_)) + else: + outfile.write('/>%s' % (eol_, )) + def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='nested1AType'): + pass + def exportChildren(self, outfile, level, namespace_='', name_='nested1AType', fromsubclass_=False, pretty_print=True): + if pretty_print: + eol_ = '\n' + else: + eol_ = '' + for nestedB1_ in self.nestedB1: + showIndent(outfile, level, pretty_print) + outfile.write('<nestedB1>%s</nestedB1>%s' % (self.gds_encode(self.gds_format_string(quote_xml(nestedB1_), input_name='nestedB1')), eol_)) + for nestedB2_ in self.nestedB2: + showIndent(outfile, level, pretty_print) + outfile.write('<nestedB2>%s</nestedB2>%s' % (self.gds_encode(self.gds_format_string(quote_xml(nestedB2_), input_name='nestedB2')), eol_)) + def build(self, node): + already_processed = set() + self.buildAttributes(node, node.attrib, already_processed) + for child in node: + nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] + self.buildChildren(child, node, nodeName_) + return self + def buildAttributes(self, node, attrs, already_processed): + pass + def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): + if nodeName_ == 'nestedB1': + nestedB1_ = child_.text + nestedB1_ = self.gds_validate_string(nestedB1_, node, 'nestedB1') + self.nestedB1.append(nestedB1_) + elif nodeName_ == 'nestedB2': + nestedB2_ = child_.text + nestedB2_ = self.gds_validate_string(nestedB2_, node, 'nestedB2') + self.nestedB2.append(nestedB2_) +# end class nested1AType + + +GDSClassesMapping = { + 'root': rootType, +} + + +USAGE_TEXT = """ +Usage: python <Parser>.py [ -s ] <in_xml_file> +""" + + +def usage(): + print(USAGE_TEXT) + sys.exit(1) + + +def get_root_tag(node): + tag = Tag_pattern_.match(node.tag).groups()[-1] + rootClass = GDSClassesMapping.get(tag) + if rootClass is None: + rootClass = globals().get(tag) + return tag, rootClass + + +def parse(inFileName, silence=False): + parser = None + doc = parsexml_(inFileName, parser) + rootNode = doc.getroot() + rootTag, rootClass = get_root_tag(rootNode) + if rootClass is None: + rootTag = 'rootType' + rootClass = rootType + rootObj = rootClass.factory() + rootObj.build(rootNode) + # Enable Python to collect the space used by the DOM. + doc = None + if not silence: + sys.stdout.write('<?xml version="1.0" ?>\n') + rootObj.export( + sys.stdout, 0, name_=rootTag, + namespacedef_='', + pretty_print=True) + return rootObj + + +def parseEtree(inFileName, silence=False): + parser = None + doc = parsexml_(inFileName, parser) + rootNode = doc.getroot() + rootTag, rootClass = get_root_tag(rootNode) + if rootClass is None: + rootTag = 'rootType' + rootClass = rootType + rootObj = rootClass.factory() + rootObj.build(rootNode) + # Enable Python to collect the space used by the DOM. + doc = None + mapping = {} + rootElement = rootObj.to_etree(None, name_=rootTag, mapping_=mapping) + reverse_mapping = rootObj.gds_reverse_node_mapping(mapping) + if not silence: + content = etree_.tostring( + rootElement, pretty_print=True, + xml_declaration=True, encoding="utf-8") + sys.stdout.write(content) + sys.stdout.write('\n') + return rootObj, rootElement, mapping, reverse_mapping + + +def parseString(inString, silence=False): + if sys.version_info.major == 2: + from StringIO import StringIO as IOBuffer + else: + from io import BytesIO as IOBuffer + parser = None + doc = parsexml_(IOBuffer(inString), parser) + rootNode = doc.getroot() + rootTag, rootClass = get_root_tag(rootNode) + if rootClass is None: + rootTag = 'rootType' + rootClass = rootType + rootObj = rootClass.factory() + rootObj.build(rootNode) + # Enable Python to collect the space used by the DOM. + doc = None + if not silence: + sys.stdout.write('<?xml version="1.0" ?>\n') + rootObj.export( + sys.stdout, 0, name_=rootTag, + namespacedef_='') + return rootObj + + +def parseLiteral(inFileName, silence=False): + parser = None + doc = parsexml_(inFileName, parser) + rootNode = doc.getroot() + rootTag, rootClass = get_root_tag(rootNode) + if rootClass is None: + rootTag = 'rootType' + rootClass = rootType + rootObj = rootClass.factory() + rootObj.build(rootNode) + # Enable Python to collect the space used by the DOM. + doc = None + if not silence: + sys.stdout.write('#from mixedcontent2_sup import *\n\n') + sys.stdout.write('import mixedcontent2_sup as model_\n\n') + sys.stdout.write('rootObj = model_.rootClass(\n') + rootObj.exportLiteral(sys.stdout, 0, name_=rootTag) + sys.stdout.write(')\n') + return rootObj + + +def main(): + args = sys.argv[1:] + if len(args) == 1: + parse(args[0]) + else: + usage() + + +if __name__ == '__main__': + #import pdb; pdb.set_trace() + main() + + +__all__ = [ + "markupType", + "nested1AType", + "nested1Type", + "nestedType", + "rootType" +] diff --git a/tests/nested_def1_sub.py b/tests/nested_def1_sub.py index bf895cbf8fee7611dcca0cb4dc59e2f204e5af20..7cb1b247feb2d9790b5331155d3c80640b7a5e3d 100644 --- a/tests/nested_def1_sub.py +++ b/tests/nested_def1_sub.py @@ -2,7 +2,7 @@ # # Generated by generateDS.py. -# Python 2.7.13 (default, Jan 19 2017, 14:48:08) [GCC 6.3.0 20170118] +# Python 2.7.14 (default, Sep 23 2017, 22:06:14) [GCC 7.2.0] # # Command line options: # ('--no-dates', '') diff --git a/tests/nested_def1_sup.py b/tests/nested_def1_sup.py index e9baab1c372f51f38f29601e4ad2134cacd6789c..1627dc469f479627a62078fef1c17de465e354d7 100644 --- a/tests/nested_def1_sup.py +++ b/tests/nested_def1_sup.py @@ -3,7 +3,7 @@ # # Generated by generateDS.py. -# Python 2.7.13 (default, Jan 19 2017, 14:48:08) [GCC 6.3.0 20170118] +# Python 2.7.14 (default, Sep 23 2017, 22:06:14) [GCC 7.2.0] # # Command line options: # ('--no-dates', '') diff --git a/tests/out1_sub.py b/tests/out1_sub.py index 892cf4d0120cff6c1abbb8aa3d57e99598fdb35b..c22e9ad1374de977d5061f0af163d66d0491e1ba 100644 --- a/tests/out1_sub.py +++ b/tests/out1_sub.py @@ -2,7 +2,7 @@ # # Generated by generateDS.py. -# Python 2.7.13 (default, Jan 19 2017, 14:48:08) [GCC 6.3.0 20170118] +# Python 2.7.14 (default, Sep 23 2017, 22:06:14) [GCC 7.2.0] # # Command line options: # ('--no-dates', '') diff --git a/tests/out1_sup.py b/tests/out1_sup.py index e84ced4c061ae195c6519bac0c729cbd9dca70ff..b2588ef79bbdbd626bac75ad9f83f6d7a3243e49 100644 --- a/tests/out1_sup.py +++ b/tests/out1_sup.py @@ -3,7 +3,7 @@ # # Generated by generateDS.py. -# Python 2.7.13 (default, Jan 19 2017, 14:48:08) [GCC 6.3.0 20170118] +# Python 2.7.14 (default, Sep 23 2017, 22:06:14) [GCC 7.2.0] # # Command line options: # ('--no-dates', '') @@ -1069,7 +1069,7 @@ class comments(GeneratedsSuper): eol_ = '' for emp_ in self.emp: showIndent(outfile, level, pretty_print) - outfile.write('<%semp>%s</%semp>%s' % (namespace_, self.gds_encode(self.gds_format_string(quote_xml(emp_), input_name='emp')), namespace_, eol_)) + outfile.write('<emp>%s</emp>%s' % (self.gds_encode(self.gds_format_string(quote_xml(emp_), input_name='emp')), eol_)) def exportLiteral(self, outfile, level, name_='comments'): level += 1 already_processed = set() @@ -1304,20 +1304,20 @@ class person(GeneratedsSuper): eol_ = '' if self.name is not None: showIndent(outfile, level, pretty_print) - outfile.write('<%sname>%s</%sname>%s' % (namespace_, self.gds_encode(self.gds_format_string(quote_xml(self.name), input_name='name')), namespace_, eol_)) + outfile.write('<name>%s</name>%s' % (self.gds_encode(self.gds_format_string(quote_xml(self.name), input_name='name')), eol_)) for interest_ in self.interest: showIndent(outfile, level, pretty_print) - outfile.write('<%sinterest>%s</%sinterest>%s' % (namespace_, self.gds_encode(self.gds_format_string(quote_xml(interest_), input_name='interest')), namespace_, eol_)) + outfile.write('<interest>%s</interest>%s' % (self.gds_encode(self.gds_format_string(quote_xml(interest_), input_name='interest')), eol_)) if self.category is not None: showIndent(outfile, level, pretty_print) - outfile.write('<%scategory>%s</%scategory>%s' % (namespace_, self.gds_format_integer(self.category, input_name='category'), namespace_, eol_)) + outfile.write('<category>%s</category>%s' % (self.gds_format_integer(self.category, input_name='category'), eol_)) for agent_ in self.agent: agent_.export(outfile, level, namespace_, name_='agent', pretty_print=pretty_print) for promoter_ in self.promoter: promoter_.export(outfile, level, namespace_, name_='promoter', pretty_print=pretty_print) if self.description is not None: showIndent(outfile, level, pretty_print) - outfile.write('<%sdescription>%s</%sdescription>%s' % (namespace_, self.gds_encode(self.gds_format_string(quote_xml(self.description), input_name='description')), namespace_, eol_)) + outfile.write('<description>%s</description>%s' % (self.gds_encode(self.gds_format_string(quote_xml(self.description), input_name='description')), eol_)) def exportLiteral(self, outfile, level, name_='person'): level += 1 already_processed = set() @@ -1693,39 +1693,39 @@ class programmer(person): eol_ = '' if self.email is not None: showIndent(outfile, level, pretty_print) - outfile.write('<%semail>%s</%semail>%s' % (namespace_, self.gds_encode(self.gds_format_string(quote_xml(self.email), input_name='email')), namespace_, eol_)) + outfile.write('<email>%s</email>%s' % (self.gds_encode(self.gds_format_string(quote_xml(self.email), input_name='email')), eol_)) if self.elposint is not None: showIndent(outfile, level, pretty_print) - outfile.write('<%selposint>%s</%selposint>%s' % (namespace_, self.gds_format_integer(self.elposint, input_name='elposint'), namespace_, eol_)) + outfile.write('<elposint>%s</elposint>%s' % (self.gds_format_integer(self.elposint, input_name='elposint'), eol_)) if self.elnonposint is not None: showIndent(outfile, level, pretty_print) - outfile.write('<%selnonposint>%s</%selnonposint>%s' % (namespace_, self.gds_format_integer(self.elnonposint, input_name='elnonposint'), namespace_, eol_)) + outfile.write('<elnonposint>%s</elnonposint>%s' % (self.gds_format_integer(self.elnonposint, input_name='elnonposint'), eol_)) if self.elnegint is not None: showIndent(outfile, level, pretty_print) - outfile.write('<%selnegint>%s</%selnegint>%s' % (namespace_, self.gds_format_integer(self.elnegint, input_name='elnegint'), namespace_, eol_)) + outfile.write('<elnegint>%s</elnegint>%s' % (self.gds_format_integer(self.elnegint, input_name='elnegint'), eol_)) if self.elnonnegint is not None: showIndent(outfile, level, pretty_print) - outfile.write('<%selnonnegint>%s</%selnonnegint>%s' % (namespace_, self.gds_format_integer(self.elnonnegint, input_name='elnonnegint'), namespace_, eol_)) + outfile.write('<elnonnegint>%s</elnonnegint>%s' % (self.gds_format_integer(self.elnonnegint, input_name='elnonnegint'), eol_)) if self.eldate is not None: showIndent(outfile, level, pretty_print) - outfile.write('<%seldate>%s</%seldate>%s' % (namespace_, self.gds_format_date(self.eldate, input_name='eldate'), namespace_, eol_)) + outfile.write('<eldate>%s</eldate>%s' % (self.gds_format_date(self.eldate, input_name='eldate'), eol_)) if self.eldatetime is not None: showIndent(outfile, level, pretty_print) - outfile.write('<%seldatetime>%s</%seldatetime>%s' % (namespace_, self.gds_format_datetime(self.eldatetime, input_name='eldatetime'), namespace_, eol_)) + outfile.write('<eldatetime>%s</eldatetime>%s' % (self.gds_format_datetime(self.eldatetime, input_name='eldatetime'), eol_)) if self.eltoken is not None: showIndent(outfile, level, pretty_print) - outfile.write('<%seltoken>%s</%seltoken>%s' % (namespace_, self.gds_encode(self.gds_format_string(quote_xml(self.eltoken), input_name='eltoken')), namespace_, eol_)) + outfile.write('<eltoken>%s</eltoken>%s' % (self.gds_encode(self.gds_format_string(quote_xml(self.eltoken), input_name='eltoken')), eol_)) if self.elshort is not None: showIndent(outfile, level, pretty_print) - outfile.write('<%selshort>%s</%selshort>%s' % (namespace_, self.gds_format_integer(self.elshort, input_name='elshort'), namespace_, eol_)) + outfile.write('<elshort>%s</elshort>%s' % (self.gds_format_integer(self.elshort, input_name='elshort'), eol_)) if self.ellong is not None: showIndent(outfile, level, pretty_print) - outfile.write('<%sellong>%s</%sellong>%s' % (namespace_, self.gds_format_integer(self.ellong, input_name='ellong'), namespace_, eol_)) + outfile.write('<ellong>%s</ellong>%s' % (self.gds_format_integer(self.ellong, input_name='ellong'), eol_)) if self.elparam is not None: self.elparam.export(outfile, level, namespace_, name_='elparam', pretty_print=pretty_print) if self.elarraytypes is not None: showIndent(outfile, level, pretty_print) - outfile.write('<%selarraytypes>%s</%selarraytypes>%s' % (namespace_, self.gds_encode(self.gds_format_string(quote_xml(self.elarraytypes), input_name='elarraytypes')), namespace_, eol_)) + outfile.write('<elarraytypes>%s</elarraytypes>%s' % (self.gds_encode(self.gds_format_string(quote_xml(self.elarraytypes), input_name='elarraytypes')), eol_)) def exportLiteral(self, outfile, level, name_='programmer'): level += 1 already_processed = set() @@ -2280,7 +2280,7 @@ class python_programmer(programmer): eol_ = '' if self.favorite_editor is not None: showIndent(outfile, level, pretty_print) - outfile.write('<%sfavorite-editor>%s</%sfavorite-editor>%s' % (namespace_, self.gds_encode(self.gds_format_string(quote_xml(self.favorite_editor), input_name='favorite-editor')), namespace_, eol_)) + outfile.write('<favorite-editor>%s</favorite-editor>%s' % (self.gds_encode(self.gds_format_string(quote_xml(self.favorite_editor), input_name='favorite-editor')), eol_)) def exportLiteral(self, outfile, level, name_='python-programmer'): level += 1 already_processed = set() @@ -2442,7 +2442,7 @@ class java_programmer(programmer): eol_ = '' if self.favorite_editor is not None: showIndent(outfile, level, pretty_print) - outfile.write('<%sfavorite-editor>%s</%sfavorite-editor>%s' % (namespace_, self.gds_encode(self.gds_format_string(quote_xml(self.favorite_editor), input_name='favorite-editor')), namespace_, eol_)) + outfile.write('<favorite-editor>%s</favorite-editor>%s' % (self.gds_encode(self.gds_format_string(quote_xml(self.favorite_editor), input_name='favorite-editor')), eol_)) def exportLiteral(self, outfile, level, name_='java-programmer'): level += 1 already_processed = set() @@ -2610,13 +2610,13 @@ class agent(GeneratedsSuper): eol_ = '' if self.firstname is not None: showIndent(outfile, level, pretty_print) - outfile.write('<%sfirstname>%s</%sfirstname>%s' % (namespace_, self.gds_encode(self.gds_format_string(quote_xml(self.firstname), input_name='firstname')), namespace_, eol_)) + outfile.write('<firstname>%s</firstname>%s' % (self.gds_encode(self.gds_format_string(quote_xml(self.firstname), input_name='firstname')), eol_)) if self.lastname is not None: showIndent(outfile, level, pretty_print) - outfile.write('<%slastname>%s</%slastname>%s' % (namespace_, self.gds_encode(self.gds_format_string(quote_xml(self.lastname), input_name='lastname')), namespace_, eol_)) + outfile.write('<lastname>%s</lastname>%s' % (self.gds_encode(self.gds_format_string(quote_xml(self.lastname), input_name='lastname')), eol_)) if self.priority is not None: showIndent(outfile, level, pretty_print) - outfile.write('<%spriority>%s</%spriority>%s' % (namespace_, self.gds_format_float(self.priority, input_name='priority'), namespace_, eol_)) + outfile.write('<priority>%s</priority>%s' % (self.gds_format_float(self.priority, input_name='priority'), eol_)) if self.info is not None: self.info.export(outfile, level, namespace_, name_='info', pretty_print=pretty_print) def exportLiteral(self, outfile, level, name_='agent'): @@ -2797,13 +2797,13 @@ class special_agent(GeneratedsSuper): eol_ = '' if self.firstname is not None: showIndent(outfile, level, pretty_print) - outfile.write('<%sfirstname>%s</%sfirstname>%s' % (namespace_, self.gds_encode(self.gds_format_string(quote_xml(self.firstname), input_name='firstname')), namespace_, eol_)) + outfile.write('<firstname>%s</firstname>%s' % (self.gds_encode(self.gds_format_string(quote_xml(self.firstname), input_name='firstname')), eol_)) if self.lastname is not None: showIndent(outfile, level, pretty_print) - outfile.write('<%slastname>%s</%slastname>%s' % (namespace_, self.gds_encode(self.gds_format_string(quote_xml(self.lastname), input_name='lastname')), namespace_, eol_)) + outfile.write('<lastname>%s</lastname>%s' % (self.gds_encode(self.gds_format_string(quote_xml(self.lastname), input_name='lastname')), eol_)) if self.priority is not None: showIndent(outfile, level, pretty_print) - outfile.write('<%spriority>%s</%spriority>%s' % (namespace_, self.gds_format_float(self.priority, input_name='priority'), namespace_, eol_)) + outfile.write('<priority>%s</priority>%s' % (self.gds_format_float(self.priority, input_name='priority'), eol_)) if self.info is not None: self.info.export(outfile, level, namespace_, name_='info', pretty_print=pretty_print) def exportLiteral(self, outfile, level, name_='special-agent'): @@ -3017,22 +3017,22 @@ class booster(GeneratedsSuper): eol_ = '' if self.firstname is not None: showIndent(outfile, level, pretty_print) - outfile.write('<%sfirstname>%s</%sfirstname>%s' % (namespace_, self.gds_encode(self.gds_format_string(quote_xml(self.firstname), input_name='firstname')), namespace_, eol_)) + outfile.write('<firstname>%s</firstname>%s' % (self.gds_encode(self.gds_format_string(quote_xml(self.firstname), input_name='firstname')), eol_)) if self.lastname is not None: showIndent(outfile, level, pretty_print) - outfile.write('<%slastname>%s</%slastname>%s' % (namespace_, self.gds_encode(self.gds_format_string(quote_xml(self.lastname), input_name='lastname')), namespace_, eol_)) + outfile.write('<lastname>%s</lastname>%s' % (self.gds_encode(self.gds_format_string(quote_xml(self.lastname), input_name='lastname')), eol_)) if self.other_name is not None: showIndent(outfile, level, pretty_print) - outfile.write('<%sother-name>%s</%sother-name>%s' % (namespace_, self.gds_format_float(self.other_name, input_name='other-name'), namespace_, eol_)) + outfile.write('<other-name>%s</other-name>%s' % (self.gds_format_float(self.other_name, input_name='other-name'), eol_)) if self.class_ is not None: showIndent(outfile, level, pretty_print) - outfile.write('<%sclass>%s</%sclass>%s' % (namespace_, self.gds_format_float(self.class_, input_name='class'), namespace_, eol_)) + outfile.write('<class>%s</class>%s' % (self.gds_format_float(self.class_, input_name='class'), eol_)) for other_value_ in self.other_value: showIndent(outfile, level, pretty_print) - outfile.write('<%sother-value>%s</%sother-value>%s' % (namespace_, self.gds_format_float(other_value_, input_name='other-value'), namespace_, eol_)) + outfile.write('<other-value>%s</other-value>%s' % (self.gds_format_float(other_value_, input_name='other-value'), eol_)) for type_ in self.type_: showIndent(outfile, level, pretty_print) - outfile.write('<%stype>%s</%stype>%s' % (namespace_, self.gds_format_float(type_, input_name='type'), namespace_, eol_)) + outfile.write('<type>%s</type>%s' % (self.gds_format_float(type_, input_name='type'), eol_)) for client_handler_ in self.client_handler: client_handler_.export(outfile, level, namespace_, name_='client-handler', pretty_print=pretty_print) def exportLiteral(self, outfile, level, name_='booster'): @@ -3421,10 +3421,10 @@ class client_handlerType(GeneratedsSuper): eol_ = '' if self.fullname is not None: showIndent(outfile, level, pretty_print) - outfile.write('<%sfullname>%s</%sfullname>%s' % (namespace_, self.gds_encode(self.gds_format_string(quote_xml(self.fullname), input_name='fullname')), namespace_, eol_)) + outfile.write('<fullname>%s</fullname>%s' % (self.gds_encode(self.gds_format_string(quote_xml(self.fullname), input_name='fullname')), eol_)) if self.refid is not None: showIndent(outfile, level, pretty_print) - outfile.write('<%srefid>%s</%srefid>%s' % (namespace_, self.gds_format_integer(self.refid, input_name='refid'), namespace_, eol_)) + outfile.write('<refid>%s</refid>%s' % (self.gds_format_integer(self.refid, input_name='refid'), eol_)) def exportLiteral(self, outfile, level, name_='client-handlerType'): level += 1 already_processed = set() diff --git a/tests/people_procincl1_sub.py b/tests/people_procincl1_sub.py index 539398bedd1dbe0e1004617e38a2248da02d5a57..ad55ab022d1507d469efcd04c32de7d699cdb83a 100644 --- a/tests/people_procincl1_sub.py +++ b/tests/people_procincl1_sub.py @@ -2,7 +2,7 @@ # # Generated by generateDS.py. -# Python 2.7.13 (default, Jan 19 2017, 14:48:08) [GCC 6.3.0 20170118] +# Python 2.7.14 (default, Sep 23 2017, 22:06:14) [GCC 7.2.0] # # Command line options: # ('--no-dates', '') diff --git a/tests/people_procincl1_sup.py b/tests/people_procincl1_sup.py index 31e7b6992df3e59483c2490fee728b8427ababe1..2fa8158f465b043ebe0d91cf14c6ca4d23cef29b 100644 --- a/tests/people_procincl1_sup.py +++ b/tests/people_procincl1_sup.py @@ -3,7 +3,7 @@ # # Generated by generateDS.py. -# Python 2.7.13 (default, Jan 19 2017, 14:48:08) [GCC 6.3.0 20170118] +# Python 2.7.14 (default, Sep 23 2017, 22:06:14) [GCC 7.2.0] # # Command line options: # ('--no-dates', '') @@ -979,10 +979,10 @@ class comments(GeneratedsSuper): eol_ = '' for emp_ in self.emp: showIndent(outfile, level, pretty_print) - outfile.write('<%semp>%s</%semp>%s' % (namespace_, self.gds_encode(self.gds_format_string(quote_xml(emp_), input_name='emp')), namespace_, eol_)) + outfile.write('<emp>%s</emp>%s' % (self.gds_encode(self.gds_format_string(quote_xml(emp_), input_name='emp')), eol_)) for bold_ in self.bold: showIndent(outfile, level, pretty_print) - outfile.write('<%sbold>%s</%sbold>%s' % (namespace_, self.gds_encode(self.gds_format_string(quote_xml(bold_), input_name='bold')), namespace_, eol_)) + outfile.write('<bold>%s</bold>%s' % (self.gds_encode(self.gds_format_string(quote_xml(bold_), input_name='bold')), eol_)) def build(self, node): already_processed = set() self.buildAttributes(node, node.attrib, already_processed) @@ -1161,20 +1161,20 @@ class person(GeneratedsSuper): eol_ = '' if self.name is not None: showIndent(outfile, level, pretty_print) - outfile.write('<%sname>%s</%sname>%s' % (namespace_, self.gds_encode(self.gds_format_string(quote_xml(self.name), input_name='name')), namespace_, eol_)) + outfile.write('<name>%s</name>%s' % (self.gds_encode(self.gds_format_string(quote_xml(self.name), input_name='name')), eol_)) for interest_ in self.interest: showIndent(outfile, level, pretty_print) - outfile.write('<%sinterest>%s</%sinterest>%s' % (namespace_, self.gds_encode(self.gds_format_string(quote_xml(interest_), input_name='interest')), namespace_, eol_)) + outfile.write('<interest>%s</interest>%s' % (self.gds_encode(self.gds_format_string(quote_xml(interest_), input_name='interest')), eol_)) if self.category is not None: showIndent(outfile, level, pretty_print) - outfile.write('<%scategory>%s</%scategory>%s' % (namespace_, self.gds_format_integer(self.category, input_name='category'), namespace_, eol_)) + outfile.write('<category>%s</category>%s' % (self.gds_format_integer(self.category, input_name='category'), eol_)) for agent_ in self.agent: agent_.export(outfile, level, namespace_, name_='agent', pretty_print=pretty_print) for promoter_ in self.promoter: promoter_.export(outfile, level, namespace_, name_='promoter', pretty_print=pretty_print) if self.description is not None: showIndent(outfile, level, pretty_print) - outfile.write('<%sdescription>%s</%sdescription>%s' % (namespace_, self.gds_encode(self.gds_format_string(quote_xml(self.description), input_name='description')), namespace_, eol_)) + outfile.write('<description>%s</description>%s' % (self.gds_encode(self.gds_format_string(quote_xml(self.description), input_name='description')), eol_)) def build(self, node): already_processed = set() self.buildAttributes(node, node.attrib, already_processed) @@ -1534,13 +1534,13 @@ class agent(GeneratedsSuper): eol_ = '' if self.firstname is not None: showIndent(outfile, level, pretty_print) - outfile.write('<%sfirstname>%s</%sfirstname>%s' % (namespace_, self.gds_encode(self.gds_format_string(quote_xml(self.firstname), input_name='firstname')), namespace_, eol_)) + outfile.write('<firstname>%s</firstname>%s' % (self.gds_encode(self.gds_format_string(quote_xml(self.firstname), input_name='firstname')), eol_)) if self.lastname is not None: showIndent(outfile, level, pretty_print) - outfile.write('<%slastname>%s</%slastname>%s' % (namespace_, self.gds_encode(self.gds_format_string(quote_xml(self.lastname), input_name='lastname')), namespace_, eol_)) + outfile.write('<lastname>%s</lastname>%s' % (self.gds_encode(self.gds_format_string(quote_xml(self.lastname), input_name='lastname')), eol_)) if self.priority is not None: showIndent(outfile, level, pretty_print) - outfile.write('<%spriority>%s</%spriority>%s' % (namespace_, self.gds_format_float(self.priority, input_name='priority'), namespace_, eol_)) + outfile.write('<priority>%s</priority>%s' % (self.gds_format_float(self.priority, input_name='priority'), eol_)) if self.info is not None: self.info.export(outfile, level, namespace_, name_='info', pretty_print=pretty_print) for vehicle_ in self.vehicle: @@ -1674,13 +1674,13 @@ class special_agent(GeneratedsSuper): eol_ = '' if self.firstname is not None: showIndent(outfile, level, pretty_print) - outfile.write('<%sfirstname>%s</%sfirstname>%s' % (namespace_, self.gds_encode(self.gds_format_string(quote_xml(self.firstname), input_name='firstname')), namespace_, eol_)) + outfile.write('<firstname>%s</firstname>%s' % (self.gds_encode(self.gds_format_string(quote_xml(self.firstname), input_name='firstname')), eol_)) if self.lastname is not None: showIndent(outfile, level, pretty_print) - outfile.write('<%slastname>%s</%slastname>%s' % (namespace_, self.gds_encode(self.gds_format_string(quote_xml(self.lastname), input_name='lastname')), namespace_, eol_)) + outfile.write('<lastname>%s</lastname>%s' % (self.gds_encode(self.gds_format_string(quote_xml(self.lastname), input_name='lastname')), eol_)) if self.priority is not None: showIndent(outfile, level, pretty_print) - outfile.write('<%spriority>%s</%spriority>%s' % (namespace_, self.gds_format_float(self.priority, input_name='priority'), namespace_, eol_)) + outfile.write('<priority>%s</priority>%s' % (self.gds_format_float(self.priority, input_name='priority'), eol_)) if self.info is not None: self.info.export(outfile, level, namespace_, name_='info', pretty_print=pretty_print) def build(self, node): @@ -1830,22 +1830,22 @@ class booster(GeneratedsSuper): eol_ = '' if self.firstname is not None: showIndent(outfile, level, pretty_print) - outfile.write('<%sfirstname>%s</%sfirstname>%s' % (namespace_, self.gds_encode(self.gds_format_string(quote_xml(self.firstname), input_name='firstname')), namespace_, eol_)) + outfile.write('<firstname>%s</firstname>%s' % (self.gds_encode(self.gds_format_string(quote_xml(self.firstname), input_name='firstname')), eol_)) if self.lastname is not None: showIndent(outfile, level, pretty_print) - outfile.write('<%slastname>%s</%slastname>%s' % (namespace_, self.gds_encode(self.gds_format_string(quote_xml(self.lastname), input_name='lastname')), namespace_, eol_)) + outfile.write('<lastname>%s</lastname>%s' % (self.gds_encode(self.gds_format_string(quote_xml(self.lastname), input_name='lastname')), eol_)) if self.other_name is not None: showIndent(outfile, level, pretty_print) - outfile.write('<%sother-name>%s</%sother-name>%s' % (namespace_, self.gds_format_float(self.other_name, input_name='other-name'), namespace_, eol_)) + outfile.write('<other-name>%s</other-name>%s' % (self.gds_format_float(self.other_name, input_name='other-name'), eol_)) if self.class_ is not None: showIndent(outfile, level, pretty_print) - outfile.write('<%sclass>%s</%sclass>%s' % (namespace_, self.gds_format_float(self.class_, input_name='class'), namespace_, eol_)) + outfile.write('<class>%s</class>%s' % (self.gds_format_float(self.class_, input_name='class'), eol_)) for other_value_ in self.other_value: showIndent(outfile, level, pretty_print) - outfile.write('<%sother-value>%s</%sother-value>%s' % (namespace_, self.gds_format_float(other_value_, input_name='other-value'), namespace_, eol_)) + outfile.write('<other-value>%s</other-value>%s' % (self.gds_format_float(other_value_, input_name='other-value'), eol_)) for type_ in self.type_: showIndent(outfile, level, pretty_print) - outfile.write('<%stype>%s</%stype>%s' % (namespace_, self.gds_format_float(type_, input_name='type'), namespace_, eol_)) + outfile.write('<type>%s</type>%s' % (self.gds_format_float(type_, input_name='type'), eol_)) for client_handler_ in self.client_handler: client_handler_.export(outfile, level, namespace_, name_='client-handler', pretty_print=pretty_print) def build(self, node): @@ -2075,7 +2075,7 @@ class vehicle(GeneratedsSuper): eol_ = '' if self.wheelcount is not None: showIndent(outfile, level, pretty_print) - outfile.write('<%swheelcount>%s</%swheelcount>%s' % (namespace_, self.gds_format_integer(self.wheelcount, input_name='wheelcount'), namespace_, eol_)) + outfile.write('<wheelcount>%s</wheelcount>%s' % (self.gds_format_integer(self.wheelcount, input_name='wheelcount'), eol_)) def build(self, node): already_processed = set() self.buildAttributes(node, node.attrib, already_processed) @@ -2162,7 +2162,7 @@ class automobile(vehicle): eol_ = '' if self.drivername is not None: showIndent(outfile, level, pretty_print) - outfile.write('<%sdrivername>%s</%sdrivername>%s' % (namespace_, self.gds_encode(self.gds_format_string(quote_xml(self.drivername), input_name='drivername')), namespace_, eol_)) + outfile.write('<drivername>%s</drivername>%s' % (self.gds_encode(self.gds_format_string(quote_xml(self.drivername), input_name='drivername')), eol_)) def build(self, node): already_processed = set() self.buildAttributes(node, node.attrib, already_processed) @@ -2243,7 +2243,7 @@ class airplane(vehicle): eol_ = '' if self.pilotname is not None: showIndent(outfile, level, pretty_print) - outfile.write('<%spilotname>%s</%spilotname>%s' % (namespace_, self.gds_encode(self.gds_format_string(quote_xml(self.pilotname), input_name='pilotname')), namespace_, eol_)) + outfile.write('<pilotname>%s</pilotname>%s' % (self.gds_encode(self.gds_format_string(quote_xml(self.pilotname), input_name='pilotname')), eol_)) def build(self, node): already_processed = set() self.buildAttributes(node, node.attrib, already_processed) @@ -2442,36 +2442,36 @@ class programmer(person): eol_ = '' if self.email is not None: showIndent(outfile, level, pretty_print) - outfile.write('<%semail>%s</%semail>%s' % (namespace_, self.gds_encode(self.gds_format_string(quote_xml(self.email), input_name='email')), namespace_, eol_)) + outfile.write('<email>%s</email>%s' % (self.gds_encode(self.gds_format_string(quote_xml(self.email), input_name='email')), eol_)) if self.elposint is not None: showIndent(outfile, level, pretty_print) - outfile.write('<%selposint>%s</%selposint>%s' % (namespace_, self.gds_format_integer(self.elposint, input_name='elposint'), namespace_, eol_)) + outfile.write('<elposint>%s</elposint>%s' % (self.gds_format_integer(self.elposint, input_name='elposint'), eol_)) if self.elnonposint is not None: showIndent(outfile, level, pretty_print) - outfile.write('<%selnonposint>%s</%selnonposint>%s' % (namespace_, self.gds_format_integer(self.elnonposint, input_name='elnonposint'), namespace_, eol_)) + outfile.write('<elnonposint>%s</elnonposint>%s' % (self.gds_format_integer(self.elnonposint, input_name='elnonposint'), eol_)) if self.elnegint is not None: showIndent(outfile, level, pretty_print) - outfile.write('<%selnegint>%s</%selnegint>%s' % (namespace_, self.gds_format_integer(self.elnegint, input_name='elnegint'), namespace_, eol_)) + outfile.write('<elnegint>%s</elnegint>%s' % (self.gds_format_integer(self.elnegint, input_name='elnegint'), eol_)) if self.elnonnegint is not None: showIndent(outfile, level, pretty_print) - outfile.write('<%selnonnegint>%s</%selnonnegint>%s' % (namespace_, self.gds_format_integer(self.elnonnegint, input_name='elnonnegint'), namespace_, eol_)) + outfile.write('<elnonnegint>%s</elnonnegint>%s' % (self.gds_format_integer(self.elnonnegint, input_name='elnonnegint'), eol_)) if self.eldate is not None: showIndent(outfile, level, pretty_print) - outfile.write('<%seldate>%s</%seldate>%s' % (namespace_, self.gds_format_date(self.eldate, input_name='eldate'), namespace_, eol_)) + outfile.write('<eldate>%s</eldate>%s' % (self.gds_format_date(self.eldate, input_name='eldate'), eol_)) if self.eltoken is not None: showIndent(outfile, level, pretty_print) - outfile.write('<%seltoken>%s</%seltoken>%s' % (namespace_, self.gds_encode(self.gds_format_string(quote_xml(self.eltoken), input_name='eltoken')), namespace_, eol_)) + outfile.write('<eltoken>%s</eltoken>%s' % (self.gds_encode(self.gds_format_string(quote_xml(self.eltoken), input_name='eltoken')), eol_)) if self.elshort is not None: showIndent(outfile, level, pretty_print) - outfile.write('<%selshort>%s</%selshort>%s' % (namespace_, self.gds_format_integer(self.elshort, input_name='elshort'), namespace_, eol_)) + outfile.write('<elshort>%s</elshort>%s' % (self.gds_format_integer(self.elshort, input_name='elshort'), eol_)) if self.ellong is not None: showIndent(outfile, level, pretty_print) - outfile.write('<%sellong>%s</%sellong>%s' % (namespace_, self.gds_format_integer(self.ellong, input_name='ellong'), namespace_, eol_)) + outfile.write('<ellong>%s</ellong>%s' % (self.gds_format_integer(self.ellong, input_name='ellong'), eol_)) if self.elparam is not None: self.elparam.export(outfile, level, namespace_, name_='elparam', pretty_print=pretty_print) if self.elarraytypes is not None: showIndent(outfile, level, pretty_print) - outfile.write('<%selarraytypes>%s</%selarraytypes>%s' % (namespace_, self.gds_encode(self.gds_format_string(quote_xml(self.elarraytypes), input_name='elarraytypes')), namespace_, eol_)) + outfile.write('<elarraytypes>%s</elarraytypes>%s' % (self.gds_encode(self.gds_format_string(quote_xml(self.elarraytypes), input_name='elarraytypes')), eol_)) def build(self, node): already_processed = set() self.buildAttributes(node, node.attrib, already_processed) @@ -2681,10 +2681,10 @@ class client_handlerType(GeneratedsSuper): eol_ = '' if self.fullname is not None: showIndent(outfile, level, pretty_print) - outfile.write('<%sfullname>%s</%sfullname>%s' % (namespace_, self.gds_encode(self.gds_format_string(quote_xml(self.fullname), input_name='fullname')), namespace_, eol_)) + outfile.write('<fullname>%s</fullname>%s' % (self.gds_encode(self.gds_format_string(quote_xml(self.fullname), input_name='fullname')), eol_)) if self.refid is not None: showIndent(outfile, level, pretty_print) - outfile.write('<%srefid>%s</%srefid>%s' % (namespace_, self.gds_format_integer(self.refid, input_name='refid'), namespace_, eol_)) + outfile.write('<refid>%s</refid>%s' % (self.gds_format_integer(self.refid, input_name='refid'), eol_)) def build(self, node): already_processed = set() self.buildAttributes(node, node.attrib, already_processed) @@ -2789,7 +2789,7 @@ class java_programmer(programmer): eol_ = '' if self.favorite_editor is not None: showIndent(outfile, level, pretty_print) - outfile.write('<%sfavorite-editor>%s</%sfavorite-editor>%s' % (namespace_, self.gds_encode(self.gds_format_string(quote_xml(self.favorite_editor), input_name='favorite-editor')), namespace_, eol_)) + outfile.write('<favorite-editor>%s</favorite-editor>%s' % (self.gds_encode(self.gds_format_string(quote_xml(self.favorite_editor), input_name='favorite-editor')), eol_)) def build(self, node): already_processed = set() self.buildAttributes(node, node.attrib, already_processed) @@ -2887,7 +2887,7 @@ class python_programmer(programmer): eol_ = '' if self.favorite_editor is not None: showIndent(outfile, level, pretty_print) - outfile.write('<%sfavorite-editor>%s</%sfavorite-editor>%s' % (namespace_, self.gds_encode(self.gds_format_string(quote_xml(self.favorite_editor), input_name='favorite-editor')), namespace_, eol_)) + outfile.write('<favorite-editor>%s</favorite-editor>%s' % (self.gds_encode(self.gds_format_string(quote_xml(self.favorite_editor), input_name='favorite-editor')), eol_)) def build(self, node): already_processed = set() self.buildAttributes(node, node.attrib, already_processed) diff --git a/tests/prefix_classname1_sub.py b/tests/prefix_classname1_sub.py index 512463cc30605ddf880f2178483d0b7f96a8b195..f815091d8dda51c60b88e0d50a0277d74f5372cc 100644 --- a/tests/prefix_classname1_sub.py +++ b/tests/prefix_classname1_sub.py @@ -2,7 +2,7 @@ # # Generated by generateDS.py. -# Python 2.7.13 (default, Jan 19 2017, 14:48:08) [GCC 6.3.0 20170118] +# Python 2.7.14 (default, Sep 23 2017, 22:06:14) [GCC 7.2.0] # # Command line options: # ('--no-dates', '') diff --git a/tests/prefix_classname1_sup.py b/tests/prefix_classname1_sup.py index 241b0bb5d996afa97bc22a7adcd522843308ddad..b28364c3fced26247332819060342d95d7e79a78 100644 --- a/tests/prefix_classname1_sup.py +++ b/tests/prefix_classname1_sup.py @@ -3,7 +3,7 @@ # # Generated by generateDS.py. -# Python 2.7.13 (default, Jan 19 2017, 14:48:08) [GCC 6.3.0 20170118] +# Python 2.7.14 (default, Sep 23 2017, 22:06:14) [GCC 7.2.0] # # Command line options: # ('--no-dates', '') @@ -949,7 +949,7 @@ class tomato_comments(GeneratedsSuper): eol_ = '' for emp_ in self.emp: showIndent(outfile, level, pretty_print) - outfile.write('<%semp>%s</%semp>%s' % (namespace_, self.gds_encode(self.gds_format_string(quote_xml(emp_), input_name='emp')), namespace_, eol_)) + outfile.write('<emp>%s</emp>%s' % (self.gds_encode(self.gds_format_string(quote_xml(emp_), input_name='emp')), eol_)) def build(self, node): already_processed = set() self.buildAttributes(node, node.attrib, already_processed) @@ -1120,20 +1120,20 @@ class tomato_person(GeneratedsSuper): eol_ = '' if self.name is not None: showIndent(outfile, level, pretty_print) - outfile.write('<%sname>%s</%sname>%s' % (namespace_, self.gds_encode(self.gds_format_string(quote_xml(self.name), input_name='name')), namespace_, eol_)) + outfile.write('<name>%s</name>%s' % (self.gds_encode(self.gds_format_string(quote_xml(self.name), input_name='name')), eol_)) for interest_ in self.interest: showIndent(outfile, level, pretty_print) - outfile.write('<%sinterest>%s</%sinterest>%s' % (namespace_, self.gds_encode(self.gds_format_string(quote_xml(interest_), input_name='interest')), namespace_, eol_)) + outfile.write('<interest>%s</interest>%s' % (self.gds_encode(self.gds_format_string(quote_xml(interest_), input_name='interest')), eol_)) if self.category is not None: showIndent(outfile, level, pretty_print) - outfile.write('<%scategory>%s</%scategory>%s' % (namespace_, self.gds_format_integer(self.category, input_name='category'), namespace_, eol_)) + outfile.write('<category>%s</category>%s' % (self.gds_format_integer(self.category, input_name='category'), eol_)) for agent_ in self.agent: agent_.export(outfile, level, namespace_, name_='agent', pretty_print=pretty_print) for promoter_ in self.promoter: promoter_.export(outfile, level, namespace_, name_='promoter', pretty_print=pretty_print) if self.description is not None: showIndent(outfile, level, pretty_print) - outfile.write('<%sdescription>%s</%sdescription>%s' % (namespace_, self.gds_encode(self.gds_format_string(quote_xml(self.description), input_name='description')), namespace_, eol_)) + outfile.write('<description>%s</description>%s' % (self.gds_encode(self.gds_format_string(quote_xml(self.description), input_name='description')), eol_)) def build(self, node): already_processed = set() self.buildAttributes(node, node.attrib, already_processed) @@ -1393,39 +1393,39 @@ class tomato_programmer(tomato_person): eol_ = '' if self.email is not None: showIndent(outfile, level, pretty_print) - outfile.write('<%semail>%s</%semail>%s' % (namespace_, self.gds_encode(self.gds_format_string(quote_xml(self.email), input_name='email')), namespace_, eol_)) + outfile.write('<email>%s</email>%s' % (self.gds_encode(self.gds_format_string(quote_xml(self.email), input_name='email')), eol_)) if self.elposint is not None: showIndent(outfile, level, pretty_print) - outfile.write('<%selposint>%s</%selposint>%s' % (namespace_, self.gds_format_integer(self.elposint, input_name='elposint'), namespace_, eol_)) + outfile.write('<elposint>%s</elposint>%s' % (self.gds_format_integer(self.elposint, input_name='elposint'), eol_)) if self.elnonposint is not None: showIndent(outfile, level, pretty_print) - outfile.write('<%selnonposint>%s</%selnonposint>%s' % (namespace_, self.gds_format_integer(self.elnonposint, input_name='elnonposint'), namespace_, eol_)) + outfile.write('<elnonposint>%s</elnonposint>%s' % (self.gds_format_integer(self.elnonposint, input_name='elnonposint'), eol_)) if self.elnegint is not None: showIndent(outfile, level, pretty_print) - outfile.write('<%selnegint>%s</%selnegint>%s' % (namespace_, self.gds_format_integer(self.elnegint, input_name='elnegint'), namespace_, eol_)) + outfile.write('<elnegint>%s</elnegint>%s' % (self.gds_format_integer(self.elnegint, input_name='elnegint'), eol_)) if self.elnonnegint is not None: showIndent(outfile, level, pretty_print) - outfile.write('<%selnonnegint>%s</%selnonnegint>%s' % (namespace_, self.gds_format_integer(self.elnonnegint, input_name='elnonnegint'), namespace_, eol_)) + outfile.write('<elnonnegint>%s</elnonnegint>%s' % (self.gds_format_integer(self.elnonnegint, input_name='elnonnegint'), eol_)) if self.eldate is not None: showIndent(outfile, level, pretty_print) - outfile.write('<%seldate>%s</%seldate>%s' % (namespace_, self.gds_format_date(self.eldate, input_name='eldate'), namespace_, eol_)) + outfile.write('<eldate>%s</eldate>%s' % (self.gds_format_date(self.eldate, input_name='eldate'), eol_)) if self.eldatetime is not None: showIndent(outfile, level, pretty_print) - outfile.write('<%seldatetime>%s</%seldatetime>%s' % (namespace_, self.gds_format_datetime(self.eldatetime, input_name='eldatetime'), namespace_, eol_)) + outfile.write('<eldatetime>%s</eldatetime>%s' % (self.gds_format_datetime(self.eldatetime, input_name='eldatetime'), eol_)) if self.eltoken is not None: showIndent(outfile, level, pretty_print) - outfile.write('<%seltoken>%s</%seltoken>%s' % (namespace_, self.gds_encode(self.gds_format_string(quote_xml(self.eltoken), input_name='eltoken')), namespace_, eol_)) + outfile.write('<eltoken>%s</eltoken>%s' % (self.gds_encode(self.gds_format_string(quote_xml(self.eltoken), input_name='eltoken')), eol_)) if self.elshort is not None: showIndent(outfile, level, pretty_print) - outfile.write('<%selshort>%s</%selshort>%s' % (namespace_, self.gds_format_integer(self.elshort, input_name='elshort'), namespace_, eol_)) + outfile.write('<elshort>%s</elshort>%s' % (self.gds_format_integer(self.elshort, input_name='elshort'), eol_)) if self.ellong is not None: showIndent(outfile, level, pretty_print) - outfile.write('<%sellong>%s</%sellong>%s' % (namespace_, self.gds_format_integer(self.ellong, input_name='ellong'), namespace_, eol_)) + outfile.write('<ellong>%s</ellong>%s' % (self.gds_format_integer(self.ellong, input_name='ellong'), eol_)) if self.elparam is not None: self.elparam.export(outfile, level, namespace_, name_='elparam', pretty_print=pretty_print) if self.elarraytypes is not None: showIndent(outfile, level, pretty_print) - outfile.write('<%selarraytypes>%s</%selarraytypes>%s' % (namespace_, self.gds_encode(self.gds_format_string(quote_xml(self.elarraytypes), input_name='elarraytypes')), namespace_, eol_)) + outfile.write('<elarraytypes>%s</elarraytypes>%s' % (self.gds_encode(self.gds_format_string(quote_xml(self.elarraytypes), input_name='elarraytypes')), eol_)) def build(self, node): already_processed = set() self.buildAttributes(node, node.attrib, already_processed) @@ -1780,7 +1780,7 @@ class tomato_python_programmer(tomato_programmer): eol_ = '' if self.favorite_editor is not None: showIndent(outfile, level, pretty_print) - outfile.write('<%sfavorite-editor>%s</%sfavorite-editor>%s' % (namespace_, self.gds_encode(self.gds_format_string(quote_xml(self.favorite_editor), input_name='favorite-editor')), namespace_, eol_)) + outfile.write('<favorite-editor>%s</favorite-editor>%s' % (self.gds_encode(self.gds_format_string(quote_xml(self.favorite_editor), input_name='favorite-editor')), eol_)) def build(self, node): already_processed = set() self.buildAttributes(node, node.attrib, already_processed) @@ -1879,7 +1879,7 @@ class tomato_java_programmer(tomato_programmer): eol_ = '' if self.favorite_editor is not None: showIndent(outfile, level, pretty_print) - outfile.write('<%sfavorite-editor>%s</%sfavorite-editor>%s' % (namespace_, self.gds_encode(self.gds_format_string(quote_xml(self.favorite_editor), input_name='favorite-editor')), namespace_, eol_)) + outfile.write('<favorite-editor>%s</favorite-editor>%s' % (self.gds_encode(self.gds_format_string(quote_xml(self.favorite_editor), input_name='favorite-editor')), eol_)) def build(self, node): already_processed = set() self.buildAttributes(node, node.attrib, already_processed) @@ -1980,13 +1980,13 @@ class tomato_agent(GeneratedsSuper): eol_ = '' if self.firstname is not None: showIndent(outfile, level, pretty_print) - outfile.write('<%sfirstname>%s</%sfirstname>%s' % (namespace_, self.gds_encode(self.gds_format_string(quote_xml(self.firstname), input_name='firstname')), namespace_, eol_)) + outfile.write('<firstname>%s</firstname>%s' % (self.gds_encode(self.gds_format_string(quote_xml(self.firstname), input_name='firstname')), eol_)) if self.lastname is not None: showIndent(outfile, level, pretty_print) - outfile.write('<%slastname>%s</%slastname>%s' % (namespace_, self.gds_encode(self.gds_format_string(quote_xml(self.lastname), input_name='lastname')), namespace_, eol_)) + outfile.write('<lastname>%s</lastname>%s' % (self.gds_encode(self.gds_format_string(quote_xml(self.lastname), input_name='lastname')), eol_)) if self.priority is not None: showIndent(outfile, level, pretty_print) - outfile.write('<%spriority>%s</%spriority>%s' % (namespace_, self.gds_format_float(self.priority, input_name='priority'), namespace_, eol_)) + outfile.write('<priority>%s</priority>%s' % (self.gds_format_float(self.priority, input_name='priority'), eol_)) if self.info is not None: self.info.export(outfile, level, namespace_, name_='info', pretty_print=pretty_print) def build(self, node): @@ -2097,13 +2097,13 @@ class tomato_special_agent(GeneratedsSuper): eol_ = '' if self.firstname is not None: showIndent(outfile, level, pretty_print) - outfile.write('<%sfirstname>%s</%sfirstname>%s' % (namespace_, self.gds_encode(self.gds_format_string(quote_xml(self.firstname), input_name='firstname')), namespace_, eol_)) + outfile.write('<firstname>%s</firstname>%s' % (self.gds_encode(self.gds_format_string(quote_xml(self.firstname), input_name='firstname')), eol_)) if self.lastname is not None: showIndent(outfile, level, pretty_print) - outfile.write('<%slastname>%s</%slastname>%s' % (namespace_, self.gds_encode(self.gds_format_string(quote_xml(self.lastname), input_name='lastname')), namespace_, eol_)) + outfile.write('<lastname>%s</lastname>%s' % (self.gds_encode(self.gds_format_string(quote_xml(self.lastname), input_name='lastname')), eol_)) if self.priority is not None: showIndent(outfile, level, pretty_print) - outfile.write('<%spriority>%s</%spriority>%s' % (namespace_, self.gds_format_float(self.priority, input_name='priority'), namespace_, eol_)) + outfile.write('<priority>%s</priority>%s' % (self.gds_format_float(self.priority, input_name='priority'), eol_)) if self.info is not None: self.info.export(outfile, level, namespace_, name_='info', pretty_print=pretty_print) def build(self, node): @@ -2247,22 +2247,22 @@ class tomato_booster(GeneratedsSuper): eol_ = '' if self.firstname is not None: showIndent(outfile, level, pretty_print) - outfile.write('<%sfirstname>%s</%sfirstname>%s' % (namespace_, self.gds_encode(self.gds_format_string(quote_xml(self.firstname), input_name='firstname')), namespace_, eol_)) + outfile.write('<firstname>%s</firstname>%s' % (self.gds_encode(self.gds_format_string(quote_xml(self.firstname), input_name='firstname')), eol_)) if self.lastname is not None: showIndent(outfile, level, pretty_print) - outfile.write('<%slastname>%s</%slastname>%s' % (namespace_, self.gds_encode(self.gds_format_string(quote_xml(self.lastname), input_name='lastname')), namespace_, eol_)) + outfile.write('<lastname>%s</lastname>%s' % (self.gds_encode(self.gds_format_string(quote_xml(self.lastname), input_name='lastname')), eol_)) if self.other_name is not None: showIndent(outfile, level, pretty_print) - outfile.write('<%sother-name>%s</%sother-name>%s' % (namespace_, self.gds_format_float(self.other_name, input_name='other-name'), namespace_, eol_)) + outfile.write('<other-name>%s</other-name>%s' % (self.gds_format_float(self.other_name, input_name='other-name'), eol_)) if self.class_ is not None: showIndent(outfile, level, pretty_print) - outfile.write('<%sclass>%s</%sclass>%s' % (namespace_, self.gds_format_float(self.class_, input_name='class'), namespace_, eol_)) + outfile.write('<class>%s</class>%s' % (self.gds_format_float(self.class_, input_name='class'), eol_)) for other_value_ in self.other_value: showIndent(outfile, level, pretty_print) - outfile.write('<%sother-value>%s</%sother-value>%s' % (namespace_, self.gds_format_float(other_value_, input_name='other-value'), namespace_, eol_)) + outfile.write('<other-value>%s</other-value>%s' % (self.gds_format_float(other_value_, input_name='other-value'), eol_)) for type_ in self.type_: showIndent(outfile, level, pretty_print) - outfile.write('<%stype>%s</%stype>%s' % (namespace_, self.gds_format_float(type_, input_name='type'), namespace_, eol_)) + outfile.write('<type>%s</type>%s' % (self.gds_format_float(type_, input_name='type'), eol_)) for client_handler_ in self.client_handler: client_handler_.export(outfile, level, namespace_, name_='client-handler', pretty_print=pretty_print) def build(self, node): @@ -2487,10 +2487,10 @@ class tomato_client_handlerType(GeneratedsSuper): eol_ = '' if self.fullname is not None: showIndent(outfile, level, pretty_print) - outfile.write('<%sfullname>%s</%sfullname>%s' % (namespace_, self.gds_encode(self.gds_format_string(quote_xml(self.fullname), input_name='fullname')), namespace_, eol_)) + outfile.write('<fullname>%s</fullname>%s' % (self.gds_encode(self.gds_format_string(quote_xml(self.fullname), input_name='fullname')), eol_)) if self.refid is not None: showIndent(outfile, level, pretty_print) - outfile.write('<%srefid>%s</%srefid>%s' % (namespace_, self.gds_format_integer(self.refid, input_name='refid'), namespace_, eol_)) + outfile.write('<refid>%s</refid>%s' % (self.gds_format_integer(self.refid, input_name='refid'), eol_)) def build(self, node): already_processed = set() self.buildAttributes(node, node.attrib, already_processed) diff --git a/tests/recursive_simpletype1_sub.py b/tests/recursive_simpletype1_sub.py index 9da5ea3648701c46acdd4b2d2dc26d5078f99b3e..44c0271fbd37b31b9b66ea29db4e8c929a1240b4 100644 --- a/tests/recursive_simpletype1_sub.py +++ b/tests/recursive_simpletype1_sub.py @@ -2,7 +2,7 @@ # # Generated by generateDS.py. -# Python 2.7.13 (default, Jan 19 2017, 14:48:08) [GCC 6.3.0 20170118] +# Python 2.7.14 (default, Sep 23 2017, 22:06:14) [GCC 7.2.0] # # Command line options: # ('--no-dates', '') diff --git a/tests/recursive_simpletype1_sup.py b/tests/recursive_simpletype1_sup.py index 2780b8e8b1d258eef0dc9b605cdb65a7afa158ff..05c042934359a285a7f954e2effdf2249486a924 100644 --- a/tests/recursive_simpletype1_sup.py +++ b/tests/recursive_simpletype1_sup.py @@ -3,7 +3,7 @@ # # Generated by generateDS.py. -# Python 2.7.13 (default, Jan 19 2017, 14:48:08) [GCC 6.3.0 20170118] +# Python 2.7.14 (default, Sep 23 2017, 22:06:14) [GCC 7.2.0] # # Command line options: # ('--no-dates', '') @@ -779,13 +779,13 @@ class PersonType(GeneratedsSuper): eol_ = '' if self.personId is not None: showIndent(outfile, level, pretty_print) - outfile.write('<%spersonId>%s</%spersonId>%s' % (namespace_, self.gds_format_integer(self.personId, input_name='personId'), namespace_, eol_)) + outfile.write('<personId>%s</personId>%s' % (self.gds_format_integer(self.personId, input_name='personId'), eol_)) if self.fname is not None: showIndent(outfile, level, pretty_print) - outfile.write('<%sfname>%s</%sfname>%s' % (namespace_, self.gds_encode(self.gds_format_string(quote_xml(self.fname), input_name='fname')), namespace_, eol_)) + outfile.write('<fname>%s</fname>%s' % (self.gds_encode(self.gds_format_string(quote_xml(self.fname), input_name='fname')), eol_)) if self.lname is not None: showIndent(outfile, level, pretty_print) - outfile.write('<%slname>%s</%slname>%s' % (namespace_, self.gds_encode(self.gds_format_string(quote_xml(self.lname), input_name='lname')), namespace_, eol_)) + outfile.write('<lname>%s</lname>%s' % (self.gds_encode(self.gds_format_string(quote_xml(self.lname), input_name='lname')), eol_)) def build(self, node): already_processed = set() self.buildAttributes(node, node.attrib, already_processed) diff --git a/tests/reference_simpletype1_sub.py b/tests/reference_simpletype1_sub.py index 497a011a24dd8ab929af8652bcc677c7cc4d601a..9866ae40e4d732cf803448ec2cf6a2f09f35ecbe 100644 --- a/tests/reference_simpletype1_sub.py +++ b/tests/reference_simpletype1_sub.py @@ -2,7 +2,7 @@ # # Generated by generateDS.py. -# Python 2.7.13 (default, Jan 19 2017, 14:48:08) [GCC 6.3.0 20170118] +# Python 2.7.14 (default, Sep 23 2017, 22:06:14) [GCC 7.2.0] # # Command line options: # ('--no-dates', '') diff --git a/tests/reference_simpletype1_sup.py b/tests/reference_simpletype1_sup.py index c3511496e78e0d0839804df4ea0ad6de59d6f3c9..3f3f4307eebd7170f0e0717552f59d0ba1332be1 100644 --- a/tests/reference_simpletype1_sup.py +++ b/tests/reference_simpletype1_sup.py @@ -3,7 +3,7 @@ # # Generated by generateDS.py. -# Python 2.7.13 (default, Jan 19 2017, 14:48:08) [GCC 6.3.0 20170118] +# Python 2.7.14 (default, Sep 23 2017, 22:06:14) [GCC 7.2.0] # # Command line options: # ('--no-dates', '') @@ -788,10 +788,10 @@ class dummy(GeneratedsSuper): eol_ = '' if self.test_ref_element is not None: showIndent(outfile, level, pretty_print) - outfile.write('<%stest_ref_element>%s</%stest_ref_element>%s' % (namespace_, self.gds_format_integer(self.test_ref_element, input_name='test_ref_element'), namespace_, eol_)) + outfile.write('<test_ref_element>%s</test_ref_element>%s' % (self.gds_format_integer(self.test_ref_element, input_name='test_ref_element'), eol_)) if self.test_normal_element is not None: showIndent(outfile, level, pretty_print) - outfile.write('<%stest_normal_element>%s</%stest_normal_element>%s' % (namespace_, self.gds_format_integer(self.test_normal_element, input_name='test_normal_element'), namespace_, eol_)) + outfile.write('<test_normal_element>%s</test_normal_element>%s' % (self.gds_format_integer(self.test_normal_element, input_name='test_normal_element'), eol_)) def build(self, node): already_processed = set() self.buildAttributes(node, node.attrib, already_processed) diff --git a/tests/rem_dup_elems1_sub.py b/tests/rem_dup_elems1_sub.py index e90ed7f00ad5111a40e1516be6adc148150fb277..4fec8a54a4bdf3b4a4bc28561e5b9218ffe323ef 100644 --- a/tests/rem_dup_elems1_sub.py +++ b/tests/rem_dup_elems1_sub.py @@ -2,7 +2,7 @@ # # Generated by generateDS.py. -# Python 2.7.13 (default, Jan 19 2017, 14:48:08) [GCC 6.3.0 20170118] +# Python 2.7.14 (default, Sep 23 2017, 22:06:14) [GCC 7.2.0] # # Command line options: # ('--no-dates', '') diff --git a/tests/rem_dup_elems1_sup.py b/tests/rem_dup_elems1_sup.py index fdd2362db89b3c39dfba729023521da93868543f..beef45bcaeb67c255fee95abcf3e2031417b3be0 100644 --- a/tests/rem_dup_elems1_sup.py +++ b/tests/rem_dup_elems1_sup.py @@ -3,7 +3,7 @@ # # Generated by generateDS.py. -# Python 2.7.13 (default, Jan 19 2017, 14:48:08) [GCC 6.3.0 20170118] +# Python 2.7.14 (default, Sep 23 2017, 22:06:14) [GCC 7.2.0] # # Command line options: # ('--no-dates', '') @@ -789,7 +789,7 @@ class authorsType(GeneratedsSuper): author_.export(outfile, level, namespace_, name_='author', pretty_print=pretty_print) for cooperation_ in self.cooperation: showIndent(outfile, level, pretty_print) - outfile.write('<%scooperation>%s</%scooperation>%s' % (namespace_, self.gds_encode(self.gds_format_string(quote_xml(cooperation_), input_name='cooperation')), namespace_, eol_)) + outfile.write('<cooperation>%s</cooperation>%s' % (self.gds_encode(self.gds_format_string(quote_xml(cooperation_), input_name='cooperation')), eol_)) def build(self, node): already_processed = set() self.buildAttributes(node, node.attrib, already_processed) @@ -871,7 +871,7 @@ class author(GeneratedsSuper): eol_ = '' if self.description is not None: showIndent(outfile, level, pretty_print) - outfile.write('<%sdescription>%s</%sdescription>%s' % (namespace_, self.gds_encode(self.gds_format_string(quote_xml(self.description), input_name='description')), namespace_, eol_)) + outfile.write('<description>%s</description>%s' % (self.gds_encode(self.gds_format_string(quote_xml(self.description), input_name='description')), eol_)) def build(self, node): already_processed = set() self.buildAttributes(node, node.attrib, already_processed) diff --git a/tests/simplecontent_restriction1_sub.py b/tests/simplecontent_restriction1_sub.py index d6902ec825a010b67349f7cf816c20e3c9bd1a1f..0e89a7960052d867ce1801cabe5e46d6db15181f 100644 --- a/tests/simplecontent_restriction1_sub.py +++ b/tests/simplecontent_restriction1_sub.py @@ -2,7 +2,7 @@ # # Generated by generateDS.py. -# Python 2.7.13 (default, Jan 19 2017, 14:48:08) [GCC 6.3.0 20170118] +# Python 2.7.14 (default, Sep 23 2017, 22:06:14) [GCC 7.2.0] # # Command line options: # ('--no-dates', '') diff --git a/tests/simplecontent_restriction1_sup.py b/tests/simplecontent_restriction1_sup.py index 60f397857b9a8d31dc5013cb9d8c50fd1dd61a09..d5f878562982234890957908e55c49ce9455561c 100644 --- a/tests/simplecontent_restriction1_sup.py +++ b/tests/simplecontent_restriction1_sup.py @@ -3,7 +3,7 @@ # # Generated by generateDS.py. -# Python 2.7.13 (default, Jan 19 2017, 14:48:08) [GCC 6.3.0 20170118] +# Python 2.7.14 (default, Sep 23 2017, 22:06:14) [GCC 7.2.0] # # Command line options: # ('--no-dates', '') diff --git a/tests/simpletype_memberspecs1_sub.py b/tests/simpletype_memberspecs1_sub.py index 6fb792df3a3fa49a857a1a85e006912c32040159..d0f58c095349cacf0dc96e8456d58f6dfe0a52dd 100644 --- a/tests/simpletype_memberspecs1_sub.py +++ b/tests/simpletype_memberspecs1_sub.py @@ -2,7 +2,7 @@ # # Generated by generateDS.py. -# Python 2.7.13 (default, Jan 19 2017, 14:48:08) [GCC 6.3.0 20170118] +# Python 2.7.14 (default, Sep 23 2017, 22:06:14) [GCC 7.2.0] # # Command line options: # ('--no-dates', '') diff --git a/tests/simpletype_memberspecs1_sup.py b/tests/simpletype_memberspecs1_sup.py index cf988926438b97361b8b1f4ccc8fcf8f6a624db2..cd93882f60bfa6aa7739d052630facf3f0e52d72 100644 --- a/tests/simpletype_memberspecs1_sup.py +++ b/tests/simpletype_memberspecs1_sup.py @@ -3,7 +3,7 @@ # # Generated by generateDS.py. -# Python 2.7.13 (default, Jan 19 2017, 14:48:08) [GCC 6.3.0 20170118] +# Python 2.7.14 (default, Sep 23 2017, 22:06:14) [GCC 7.2.0] # # Command line options: # ('--no-dates', '') diff --git a/tests/simpletypes_other1_sub.py b/tests/simpletypes_other1_sub.py index 4ca865bcf78b82f3a235cb650012347c219bd1f8..d3758212d66f8438010eefbb79e8249bde77eaf5 100644 --- a/tests/simpletypes_other1_sub.py +++ b/tests/simpletypes_other1_sub.py @@ -2,7 +2,7 @@ # # Generated by generateDS.py. -# Python 2.7.13 (default, Jan 19 2017, 14:48:08) [GCC 6.3.0 20170118] +# Python 2.7.14 (default, Sep 23 2017, 22:06:14) [GCC 7.2.0] # # Command line options: # ('--no-dates', '') diff --git a/tests/simpletypes_other1_sup.py b/tests/simpletypes_other1_sup.py index e3c05a322943a9ae85cec1380fc116306702f301..b29530995aa20af955b893b69e8d68e363210410 100644 --- a/tests/simpletypes_other1_sup.py +++ b/tests/simpletypes_other1_sup.py @@ -3,7 +3,7 @@ # # Generated by generateDS.py. -# Python 2.7.13 (default, Jan 19 2017, 14:48:08) [GCC 6.3.0 20170118] +# Python 2.7.14 (default, Sep 23 2017, 22:06:14) [GCC 7.2.0] # # Command line options: # ('--no-dates', '') @@ -1008,67 +1008,67 @@ class simpleTypeTestDefs(GeneratedsSuper): eol_ = '' if self.datetime1 is not None: showIndent(outfile, level, pretty_print) - outfile.write('<%sdatetime1>%s</%sdatetime1>%s' % (namespace_, self.gds_encode(self.gds_format_string(quote_xml(self.datetime1), input_name='datetime1')), namespace_, eol_)) + outfile.write('<datetime1>%s</datetime1>%s' % (self.gds_encode(self.gds_format_string(quote_xml(self.datetime1), input_name='datetime1')), eol_)) if self.datetime2 is not None: showIndent(outfile, level, pretty_print) - outfile.write('<%sdatetime2>%s</%sdatetime2>%s' % (namespace_, self.gds_encode(self.gds_format_string(quote_xml(self.datetime2), input_name='datetime2')), namespace_, eol_)) + outfile.write('<datetime2>%s</datetime2>%s' % (self.gds_encode(self.gds_format_string(quote_xml(self.datetime2), input_name='datetime2')), eol_)) if self.datetime3 is not None: showIndent(outfile, level, pretty_print) - outfile.write('<%sdatetime3>%s</%sdatetime3>%s' % (namespace_, self.gds_encode(self.gds_format_string(quote_xml(self.datetime3), input_name='datetime3')), namespace_, eol_)) + outfile.write('<datetime3>%s</datetime3>%s' % (self.gds_encode(self.gds_format_string(quote_xml(self.datetime3), input_name='datetime3')), eol_)) if self.datetime4 is not None: showIndent(outfile, level, pretty_print) - outfile.write('<%sdatetime4>%s</%sdatetime4>%s' % (namespace_, self.gds_encode(self.gds_format_string(quote_xml(self.datetime4), input_name='datetime4')), namespace_, eol_)) + outfile.write('<datetime4>%s</datetime4>%s' % (self.gds_encode(self.gds_format_string(quote_xml(self.datetime4), input_name='datetime4')), eol_)) if self.datetime5 is not None: showIndent(outfile, level, pretty_print) - outfile.write('<%sdatetime5>%s</%sdatetime5>%s' % (namespace_, self.gds_encode(self.gds_format_string(quote_xml(self.datetime5), input_name='datetime5')), namespace_, eol_)) + outfile.write('<datetime5>%s</datetime5>%s' % (self.gds_encode(self.gds_format_string(quote_xml(self.datetime5), input_name='datetime5')), eol_)) if self.integerVal1 is not None: showIndent(outfile, level, pretty_print) - outfile.write('<%sintegerVal1>%s</%sintegerVal1>%s' % (namespace_, self.gds_format_integer(self.integerVal1, input_name='integerVal1'), namespace_, eol_)) + outfile.write('<integerVal1>%s</integerVal1>%s' % (self.gds_format_integer(self.integerVal1, input_name='integerVal1'), eol_)) for integerVal2_ in self.integerVal2: showIndent(outfile, level, pretty_print) - outfile.write('<%sintegerVal2>%s</%sintegerVal2>%s' % (namespace_, self.gds_format_integer(integerVal2_, input_name='integerVal2'), namespace_, eol_)) + outfile.write('<integerVal2>%s</integerVal2>%s' % (self.gds_format_integer(integerVal2_, input_name='integerVal2'), eol_)) if self.stringVal1 is not None: showIndent(outfile, level, pretty_print) - outfile.write('<%sstringVal1>%s</%sstringVal1>%s' % (namespace_, self.gds_encode(self.gds_format_string(quote_xml(self.stringVal1), input_name='stringVal1')), namespace_, eol_)) + outfile.write('<stringVal1>%s</stringVal1>%s' % (self.gds_encode(self.gds_format_string(quote_xml(self.stringVal1), input_name='stringVal1')), eol_)) for stringVal2_ in self.stringVal2: showIndent(outfile, level, pretty_print) - outfile.write('<%sstringVal2>%s</%sstringVal2>%s' % (namespace_, self.gds_encode(self.gds_format_string(quote_xml(stringVal2_), input_name='stringVal2')), namespace_, eol_)) + outfile.write('<stringVal2>%s</stringVal2>%s' % (self.gds_encode(self.gds_format_string(quote_xml(stringVal2_), input_name='stringVal2')), eol_)) if self.booleanVal1 is not None: showIndent(outfile, level, pretty_print) - outfile.write('<%sbooleanVal1>%s</%sbooleanVal1>%s' % (namespace_, self.gds_format_boolean(self.booleanVal1, input_name='booleanVal1'), namespace_, eol_)) + outfile.write('<booleanVal1>%s</booleanVal1>%s' % (self.gds_format_boolean(self.booleanVal1, input_name='booleanVal1'), eol_)) for booleanVal2_ in self.booleanVal2: showIndent(outfile, level, pretty_print) - outfile.write('<%sbooleanVal2>%s</%sbooleanVal2>%s' % (namespace_, self.gds_format_boolean(booleanVal2_, input_name='booleanVal2'), namespace_, eol_)) + outfile.write('<booleanVal2>%s</booleanVal2>%s' % (self.gds_format_boolean(booleanVal2_, input_name='booleanVal2'), eol_)) if self.decimalVal1 is not None: showIndent(outfile, level, pretty_print) - outfile.write('<%sdecimalVal1>%s</%sdecimalVal1>%s' % (namespace_, self.gds_format_float(self.decimalVal1, input_name='decimalVal1'), namespace_, eol_)) + outfile.write('<decimalVal1>%s</decimalVal1>%s' % (self.gds_format_float(self.decimalVal1, input_name='decimalVal1'), eol_)) for decimalVal2_ in self.decimalVal2: showIndent(outfile, level, pretty_print) - outfile.write('<%sdecimalVal2>%s</%sdecimalVal2>%s' % (namespace_, self.gds_format_float(decimalVal2_, input_name='decimalVal2'), namespace_, eol_)) + outfile.write('<decimalVal2>%s</decimalVal2>%s' % (self.gds_format_float(decimalVal2_, input_name='decimalVal2'), eol_)) if self.doubleVal1 is not None: showIndent(outfile, level, pretty_print) - outfile.write('<%sdoubleVal1>%s</%sdoubleVal1>%s' % (namespace_, self.gds_format_double(self.doubleVal1, input_name='doubleVal1'), namespace_, eol_)) + outfile.write('<doubleVal1>%s</doubleVal1>%s' % (self.gds_format_double(self.doubleVal1, input_name='doubleVal1'), eol_)) for doubleVal2_ in self.doubleVal2: showIndent(outfile, level, pretty_print) - outfile.write('<%sdoubleVal2>%s</%sdoubleVal2>%s' % (namespace_, self.gds_format_double(doubleVal2_, input_name='doubleVal2'), namespace_, eol_)) + outfile.write('<doubleVal2>%s</doubleVal2>%s' % (self.gds_format_double(doubleVal2_, input_name='doubleVal2'), eol_)) if self.floatVal1 is not None: showIndent(outfile, level, pretty_print) - outfile.write('<%sfloatVal1>%s</%sfloatVal1>%s' % (namespace_, self.gds_format_float(self.floatVal1, input_name='floatVal1'), namespace_, eol_)) + outfile.write('<floatVal1>%s</floatVal1>%s' % (self.gds_format_float(self.floatVal1, input_name='floatVal1'), eol_)) for floatVal2_ in self.floatVal2: showIndent(outfile, level, pretty_print) - outfile.write('<%sfloatVal2>%s</%sfloatVal2>%s' % (namespace_, self.gds_format_float(floatVal2_, input_name='floatVal2'), namespace_, eol_)) + outfile.write('<floatVal2>%s</floatVal2>%s' % (self.gds_format_float(floatVal2_, input_name='floatVal2'), eol_)) if self.dateVal1 is not None: showIndent(outfile, level, pretty_print) - outfile.write('<%sdateVal1>%s</%sdateVal1>%s' % (namespace_, self.gds_format_date(self.dateVal1, input_name='dateVal1'), namespace_, eol_)) + outfile.write('<dateVal1>%s</dateVal1>%s' % (self.gds_format_date(self.dateVal1, input_name='dateVal1'), eol_)) for dateVal2_ in self.dateVal2: showIndent(outfile, level, pretty_print) - outfile.write('<%sdateVal2>%s</%sdateVal2>%s' % (namespace_, self.gds_format_date(dateVal2_, input_name='dateVal2'), namespace_, eol_)) + outfile.write('<dateVal2>%s</dateVal2>%s' % (self.gds_format_date(dateVal2_, input_name='dateVal2'), eol_)) if self.dateTimeVal1 is not None: showIndent(outfile, level, pretty_print) - outfile.write('<%sdateTimeVal1>%s</%sdateTimeVal1>%s' % (namespace_, self.gds_format_datetime(self.dateTimeVal1, input_name='dateTimeVal1'), namespace_, eol_)) + outfile.write('<dateTimeVal1>%s</dateTimeVal1>%s' % (self.gds_format_datetime(self.dateTimeVal1, input_name='dateTimeVal1'), eol_)) for dateTimeVal2_ in self.dateTimeVal2: showIndent(outfile, level, pretty_print) - outfile.write('<%sdateTimeVal2>%s</%sdateTimeVal2>%s' % (namespace_, self.gds_format_datetime(dateTimeVal2_, input_name='dateTimeVal2'), namespace_, eol_)) + outfile.write('<dateTimeVal2>%s</dateTimeVal2>%s' % (self.gds_format_datetime(dateTimeVal2_, input_name='dateTimeVal2'), eol_)) def build(self, node): already_processed = set() self.buildAttributes(node, node.attrib, already_processed) diff --git a/tests/test.py b/tests/test.py index 5a93f7795eca0bb76f35462e8956cdde7c229607..66d69bb52a35ba2309d30a7e1fb099757582a434 100755 --- a/tests/test.py +++ b/tests/test.py @@ -846,6 +846,32 @@ class GenTest(unittest.TestCase): #self.remove('{}2_sub.py'.format(t_)) #self.remove('{}2_out.xml'.format(t_)) + def test_034_mixedcontent(self): + cmdTempl = ( + 'python generateDS.py --no-dates --no-versions ' + '--member-specs=list -f ' + '-o tests/%s2_sup.py -s tests/%s2_sub.py ' + '--super=%s2_sup ' + 'tests/%s.xsd' + ) + t_ = 'mixedcontent' + cmd = cmdTempl % (t_, t_, t_, t_, ) + self.executeClean(cmd, cwd='..') + self.compareFiles( + '{}1_sup.py'.format(t_), + '{}2_sup.py'.format(t_), + ('sys.stdout.write',)) + self.compareFiles('{}1_sub.py'.format(t_), '{}2_sub.py'.format(t_)) + # Need to preserve generated files for next command, cleanup at end + cmdTempl = 'python tests/%s2_sup.py tests/%s.xml > tests/%s2_out.xml' + cmd = cmdTempl % (t_, t_, t_, ) + self.executeClean(cmd, cwd='..') + self.compareFiles('{}1_out.xml'.format(t_), '{}2_out.xml'.format(t_)) + # cleanup generated files + self.remove('{}2_sup.py'.format(t_)) + self.remove('{}2_sub.py'.format(t_)) + self.remove('{}2_out.xml'.format(t_)) + def compareFiles(self, left, right, ignore=None): with open(left) as left_file: with open(right) as right_file: diff --git a/tests/to_etree1_sub.py b/tests/to_etree1_sub.py index bf225acedef97a555b4573f26055ae4db13dd3e7..34b23c3c0d2b73f5219dd0043fc8f4435cb4a57f 100644 --- a/tests/to_etree1_sub.py +++ b/tests/to_etree1_sub.py @@ -2,7 +2,7 @@ # # Generated by generateDS.py. -# Python 2.7.13 (default, Jan 19 2017, 14:48:08) [GCC 6.3.0 20170118] +# Python 2.7.14 (default, Sep 23 2017, 22:06:14) [GCC 7.2.0] # # Command line options: # ('--no-dates', '') diff --git a/tests/to_etree1_sup.py b/tests/to_etree1_sup.py index 2237549360ce12aa5683244f2a98eaf61efacb29..caca1079e2eaeb34dea1708ad0a4b1f5e5cb18e3 100644 --- a/tests/to_etree1_sup.py +++ b/tests/to_etree1_sup.py @@ -3,7 +3,7 @@ # # Generated by generateDS.py. -# Python 2.7.13 (default, Jan 19 2017, 14:48:08) [GCC 6.3.0 20170118] +# Python 2.7.14 (default, Sep 23 2017, 22:06:14) [GCC 7.2.0] # # Command line options: # ('--no-dates', '') diff --git a/tests/validate_simpletypes1_sub.py b/tests/validate_simpletypes1_sub.py index f0f89035ae18709c6a19442b50eeee2604fbcc28..a78dd6dcd71b166d5183c43c5d3d24ff14b3711b 100644 --- a/tests/validate_simpletypes1_sub.py +++ b/tests/validate_simpletypes1_sub.py @@ -2,7 +2,7 @@ # # Generated by generateDS.py. -# Python 2.7.13 (default, Jan 19 2017, 14:48:08) [GCC 6.3.0 20170118] +# Python 2.7.14 (default, Sep 23 2017, 22:06:14) [GCC 7.2.0] # # Command line options: # ('--no-dates', '') diff --git a/tests/validate_simpletypes1_sup.py b/tests/validate_simpletypes1_sup.py index 85f44cda31042bedc434c04ec15929ad6408a38d..23e80e3176a6f35e70f694b168ac4a7c9fc666bf 100644 --- a/tests/validate_simpletypes1_sup.py +++ b/tests/validate_simpletypes1_sup.py @@ -3,7 +3,7 @@ # # Generated by generateDS.py. -# Python 2.7.13 (default, Jan 19 2017, 14:48:08) [GCC 6.3.0 20170118] +# Python 2.7.14 (default, Sep 23 2017, 22:06:14) [GCC 7.2.0] # # Command line options: # ('--no-dates', '') @@ -1229,76 +1229,76 @@ class simpleOneType(GeneratedsSuper): eol_ = '' if self.integer_range_1_value is not None: showIndent(outfile, level, pretty_print) - outfile.write('<%sinteger_range_1_value>%s</%sinteger_range_1_value>%s' % (namespace_, self.gds_format_integer(self.integer_range_1_value, input_name='integer_range_1_value'), namespace_, eol_)) + outfile.write('<integer_range_1_value>%s</integer_range_1_value>%s' % (self.gds_format_integer(self.integer_range_1_value, input_name='integer_range_1_value'), eol_)) if self.pattern_value is not None: showIndent(outfile, level, pretty_print) - outfile.write('<%spattern_value>%s</%spattern_value>%s' % (namespace_, self.gds_encode(self.gds_format_string(quote_xml(self.pattern_value), input_name='pattern_value')), namespace_, eol_)) + outfile.write('<pattern_value>%s</pattern_value>%s' % (self.gds_encode(self.gds_format_string(quote_xml(self.pattern_value), input_name='pattern_value')), eol_)) if self.token_enum_value is not None: showIndent(outfile, level, pretty_print) - outfile.write('<%stoken_enum_value>%s</%stoken_enum_value>%s' % (namespace_, self.gds_encode(self.gds_format_string(quote_xml(self.token_enum_value), input_name='token_enum_value')), namespace_, eol_)) + outfile.write('<token_enum_value>%s</token_enum_value>%s' % (self.gds_encode(self.gds_format_string(quote_xml(self.token_enum_value), input_name='token_enum_value')), eol_)) if self.integer_range_incl_value is not None: showIndent(outfile, level, pretty_print) - outfile.write('<%sinteger_range_incl_value>%s</%sinteger_range_incl_value>%s' % (namespace_, self.gds_format_integer(self.integer_range_incl_value, input_name='integer_range_incl_value'), namespace_, eol_)) + outfile.write('<integer_range_incl_value>%s</integer_range_incl_value>%s' % (self.gds_format_integer(self.integer_range_incl_value, input_name='integer_range_incl_value'), eol_)) if self.integer_range_excl_value is not None: showIndent(outfile, level, pretty_print) - outfile.write('<%sinteger_range_excl_value>%s</%sinteger_range_excl_value>%s' % (namespace_, self.gds_format_integer(self.integer_range_excl_value, input_name='integer_range_excl_value'), namespace_, eol_)) + outfile.write('<integer_range_excl_value>%s</integer_range_excl_value>%s' % (self.gds_format_integer(self.integer_range_excl_value, input_name='integer_range_excl_value'), eol_)) if self.min_max_length_value is not None: showIndent(outfile, level, pretty_print) - outfile.write('<%smin_max_length_value>%s</%smin_max_length_value>%s' % (namespace_, self.gds_encode(self.gds_format_string(quote_xml(self.min_max_length_value), input_name='min_max_length_value')), namespace_, eol_)) + outfile.write('<min_max_length_value>%s</min_max_length_value>%s' % (self.gds_encode(self.gds_format_string(quote_xml(self.min_max_length_value), input_name='min_max_length_value')), eol_)) if self.length_value is not None: showIndent(outfile, level, pretty_print) - outfile.write('<%slength_value>%s</%slength_value>%s' % (namespace_, self.gds_encode(self.gds_format_string(quote_xml(self.length_value), input_name='length_value')), namespace_, eol_)) + outfile.write('<length_value>%s</length_value>%s' % (self.gds_encode(self.gds_format_string(quote_xml(self.length_value), input_name='length_value')), eol_)) if self.totalDigits_value is not None: showIndent(outfile, level, pretty_print) - outfile.write('<%stotalDigits_value>%s</%stotalDigits_value>%s' % (namespace_, self.gds_format_float(self.totalDigits_value, input_name='totalDigits_value'), namespace_, eol_)) + outfile.write('<totalDigits_value>%s</totalDigits_value>%s' % (self.gds_format_float(self.totalDigits_value, input_name='totalDigits_value'), eol_)) if self.date_minincl_value is not None: showIndent(outfile, level, pretty_print) - outfile.write('<%sdate_minincl_value>%s</%sdate_minincl_value>%s' % (namespace_, self.gds_format_date(self.date_minincl_value, input_name='date_minincl_value'), namespace_, eol_)) + outfile.write('<date_minincl_value>%s</date_minincl_value>%s' % (self.gds_format_date(self.date_minincl_value, input_name='date_minincl_value'), eol_)) if self.date_maxincl_value is not None: showIndent(outfile, level, pretty_print) - outfile.write('<%sdate_maxincl_value>%s</%sdate_maxincl_value>%s' % (namespace_, self.gds_format_date(self.date_maxincl_value, input_name='date_maxincl_value'), namespace_, eol_)) + outfile.write('<date_maxincl_value>%s</date_maxincl_value>%s' % (self.gds_format_date(self.date_maxincl_value, input_name='date_maxincl_value'), eol_)) if self.date_minexcl_value is not None: showIndent(outfile, level, pretty_print) - outfile.write('<%sdate_minexcl_value>%s</%sdate_minexcl_value>%s' % (namespace_, self.gds_format_date(self.date_minexcl_value, input_name='date_minexcl_value'), namespace_, eol_)) + outfile.write('<date_minexcl_value>%s</date_minexcl_value>%s' % (self.gds_format_date(self.date_minexcl_value, input_name='date_minexcl_value'), eol_)) if self.date_maxexcl_value is not None: showIndent(outfile, level, pretty_print) - outfile.write('<%sdate_maxexcl_value>%s</%sdate_maxexcl_value>%s' % (namespace_, self.gds_format_date(self.date_maxexcl_value, input_name='date_maxexcl_value'), namespace_, eol_)) + outfile.write('<date_maxexcl_value>%s</date_maxexcl_value>%s' % (self.gds_format_date(self.date_maxexcl_value, input_name='date_maxexcl_value'), eol_)) if self.time_minincl_value is not None: showIndent(outfile, level, pretty_print) - outfile.write('<%stime_minincl_value>%s</%stime_minincl_value>%s' % (namespace_, self.gds_format_time(self.time_minincl_value, input_name='time_minincl_value'), namespace_, eol_)) + outfile.write('<time_minincl_value>%s</time_minincl_value>%s' % (self.gds_format_time(self.time_minincl_value, input_name='time_minincl_value'), eol_)) if self.time_maxincl_value is not None: showIndent(outfile, level, pretty_print) - outfile.write('<%stime_maxincl_value>%s</%stime_maxincl_value>%s' % (namespace_, self.gds_format_time(self.time_maxincl_value, input_name='time_maxincl_value'), namespace_, eol_)) + outfile.write('<time_maxincl_value>%s</time_maxincl_value>%s' % (self.gds_format_time(self.time_maxincl_value, input_name='time_maxincl_value'), eol_)) if self.time_minexcl_value is not None: showIndent(outfile, level, pretty_print) - outfile.write('<%stime_minexcl_value>%s</%stime_minexcl_value>%s' % (namespace_, self.gds_format_time(self.time_minexcl_value, input_name='time_minexcl_value'), namespace_, eol_)) + outfile.write('<time_minexcl_value>%s</time_minexcl_value>%s' % (self.gds_format_time(self.time_minexcl_value, input_name='time_minexcl_value'), eol_)) if self.time_maxexcl_value is not None: showIndent(outfile, level, pretty_print) - outfile.write('<%stime_maxexcl_value>%s</%stime_maxexcl_value>%s' % (namespace_, self.gds_format_time(self.time_maxexcl_value, input_name='time_maxexcl_value'), namespace_, eol_)) + outfile.write('<time_maxexcl_value>%s</time_maxexcl_value>%s' % (self.gds_format_time(self.time_maxexcl_value, input_name='time_maxexcl_value'), eol_)) if self.datetime_minincl_value is not None: showIndent(outfile, level, pretty_print) - outfile.write('<%sdatetime_minincl_value>%s</%sdatetime_minincl_value>%s' % (namespace_, self.gds_format_datetime(self.datetime_minincl_value, input_name='datetime_minincl_value'), namespace_, eol_)) + outfile.write('<datetime_minincl_value>%s</datetime_minincl_value>%s' % (self.gds_format_datetime(self.datetime_minincl_value, input_name='datetime_minincl_value'), eol_)) if self.datetime_maxincl_value is not None: showIndent(outfile, level, pretty_print) - outfile.write('<%sdatetime_maxincl_value>%s</%sdatetime_maxincl_value>%s' % (namespace_, self.gds_format_datetime(self.datetime_maxincl_value, input_name='datetime_maxincl_value'), namespace_, eol_)) + outfile.write('<datetime_maxincl_value>%s</datetime_maxincl_value>%s' % (self.gds_format_datetime(self.datetime_maxincl_value, input_name='datetime_maxincl_value'), eol_)) if self.datetime_minexcl_value is not None: showIndent(outfile, level, pretty_print) - outfile.write('<%sdatetime_minexcl_value>%s</%sdatetime_minexcl_value>%s' % (namespace_, self.gds_format_datetime(self.datetime_minexcl_value, input_name='datetime_minexcl_value'), namespace_, eol_)) + outfile.write('<datetime_minexcl_value>%s</datetime_minexcl_value>%s' % (self.gds_format_datetime(self.datetime_minexcl_value, input_name='datetime_minexcl_value'), eol_)) if self.datetime_maxexcl_value is not None: showIndent(outfile, level, pretty_print) - outfile.write('<%sdatetime_maxexcl_value>%s</%sdatetime_maxexcl_value>%s' % (namespace_, self.gds_format_datetime(self.datetime_maxexcl_value, input_name='datetime_maxexcl_value'), namespace_, eol_)) + outfile.write('<datetime_maxexcl_value>%s</datetime_maxexcl_value>%s' % (self.gds_format_datetime(self.datetime_maxexcl_value, input_name='datetime_maxexcl_value'), eol_)) if self.vbar_pattern_value is not None: showIndent(outfile, level, pretty_print) - outfile.write('<%svbar_pattern_value>%s</%svbar_pattern_value>%s' % (namespace_, self.gds_encode(self.gds_format_string(quote_xml(self.vbar_pattern_value), input_name='vbar_pattern_value')), namespace_, eol_)) + outfile.write('<vbar_pattern_value>%s</vbar_pattern_value>%s' % (self.gds_encode(self.gds_format_string(quote_xml(self.vbar_pattern_value), input_name='vbar_pattern_value')), eol_)) if self.anonymous_float_value is not None: showIndent(outfile, level, pretty_print) - outfile.write('<%sanonymous_float_value>%s</%sanonymous_float_value>%s' % (namespace_, self.gds_format_float(self.anonymous_float_value, input_name='anonymous_float_value'), namespace_, eol_)) + outfile.write('<anonymous_float_value>%s</anonymous_float_value>%s' % (self.gds_format_float(self.anonymous_float_value, input_name='anonymous_float_value'), eol_)) if self.primative_integer is not None: showIndent(outfile, level, pretty_print) - outfile.write('<%sprimative_integer>%s</%sprimative_integer>%s' % (namespace_, self.gds_format_integer(self.primative_integer, input_name='primative_integer'), namespace_, eol_)) + outfile.write('<primative_integer>%s</primative_integer>%s' % (self.gds_format_integer(self.primative_integer, input_name='primative_integer'), eol_)) if self.primative_float is not None: showIndent(outfile, level, pretty_print) - outfile.write('<%sprimative_float>%s</%sprimative_float>%s' % (namespace_, self.gds_format_float(self.primative_float, input_name='primative_float'), namespace_, eol_)) + outfile.write('<primative_float>%s</primative_float>%s' % (self.gds_format_float(self.primative_float, input_name='primative_float'), eol_)) def build(self, node): already_processed = set() self.buildAttributes(node, node.attrib, already_processed) @@ -1624,7 +1624,7 @@ class simpleTwoElementOneType(GeneratedsSuper): eol_ = '' if self.simpleTwoElementTwo is not None: showIndent(outfile, level, pretty_print) - outfile.write('<%ssimpleTwoElementTwo>%s</%ssimpleTwoElementTwo>%s' % (namespace_, self.gds_encode(self.gds_format_string(quote_xml(self.simpleTwoElementTwo), input_name='simpleTwoElementTwo')), namespace_, eol_)) + outfile.write('<simpleTwoElementTwo>%s</simpleTwoElementTwo>%s' % (self.gds_encode(self.gds_format_string(quote_xml(self.simpleTwoElementTwo), input_name='simpleTwoElementTwo')), eol_)) def build(self, node): already_processed = set() self.buildAttributes(node, node.attrib, already_processed) diff --git a/tests/validate_simpletypes2_sub.py b/tests/validate_simpletypes2_sub.py index f0f89035ae18709c6a19442b50eeee2604fbcc28..a78dd6dcd71b166d5183c43c5d3d24ff14b3711b 100644 --- a/tests/validate_simpletypes2_sub.py +++ b/tests/validate_simpletypes2_sub.py @@ -2,7 +2,7 @@ # # Generated by generateDS.py. -# Python 2.7.13 (default, Jan 19 2017, 14:48:08) [GCC 6.3.0 20170118] +# Python 2.7.14 (default, Sep 23 2017, 22:06:14) [GCC 7.2.0] # # Command line options: # ('--no-dates', '') diff --git a/tests/validate_simpletypes2_sup.py b/tests/validate_simpletypes2_sup.py index 85f44cda31042bedc434c04ec15929ad6408a38d..23e80e3176a6f35e70f694b168ac4a7c9fc666bf 100644 --- a/tests/validate_simpletypes2_sup.py +++ b/tests/validate_simpletypes2_sup.py @@ -3,7 +3,7 @@ # # Generated by generateDS.py. -# Python 2.7.13 (default, Jan 19 2017, 14:48:08) [GCC 6.3.0 20170118] +# Python 2.7.14 (default, Sep 23 2017, 22:06:14) [GCC 7.2.0] # # Command line options: # ('--no-dates', '') @@ -1229,76 +1229,76 @@ class simpleOneType(GeneratedsSuper): eol_ = '' if self.integer_range_1_value is not None: showIndent(outfile, level, pretty_print) - outfile.write('<%sinteger_range_1_value>%s</%sinteger_range_1_value>%s' % (namespace_, self.gds_format_integer(self.integer_range_1_value, input_name='integer_range_1_value'), namespace_, eol_)) + outfile.write('<integer_range_1_value>%s</integer_range_1_value>%s' % (self.gds_format_integer(self.integer_range_1_value, input_name='integer_range_1_value'), eol_)) if self.pattern_value is not None: showIndent(outfile, level, pretty_print) - outfile.write('<%spattern_value>%s</%spattern_value>%s' % (namespace_, self.gds_encode(self.gds_format_string(quote_xml(self.pattern_value), input_name='pattern_value')), namespace_, eol_)) + outfile.write('<pattern_value>%s</pattern_value>%s' % (self.gds_encode(self.gds_format_string(quote_xml(self.pattern_value), input_name='pattern_value')), eol_)) if self.token_enum_value is not None: showIndent(outfile, level, pretty_print) - outfile.write('<%stoken_enum_value>%s</%stoken_enum_value>%s' % (namespace_, self.gds_encode(self.gds_format_string(quote_xml(self.token_enum_value), input_name='token_enum_value')), namespace_, eol_)) + outfile.write('<token_enum_value>%s</token_enum_value>%s' % (self.gds_encode(self.gds_format_string(quote_xml(self.token_enum_value), input_name='token_enum_value')), eol_)) if self.integer_range_incl_value is not None: showIndent(outfile, level, pretty_print) - outfile.write('<%sinteger_range_incl_value>%s</%sinteger_range_incl_value>%s' % (namespace_, self.gds_format_integer(self.integer_range_incl_value, input_name='integer_range_incl_value'), namespace_, eol_)) + outfile.write('<integer_range_incl_value>%s</integer_range_incl_value>%s' % (self.gds_format_integer(self.integer_range_incl_value, input_name='integer_range_incl_value'), eol_)) if self.integer_range_excl_value is not None: showIndent(outfile, level, pretty_print) - outfile.write('<%sinteger_range_excl_value>%s</%sinteger_range_excl_value>%s' % (namespace_, self.gds_format_integer(self.integer_range_excl_value, input_name='integer_range_excl_value'), namespace_, eol_)) + outfile.write('<integer_range_excl_value>%s</integer_range_excl_value>%s' % (self.gds_format_integer(self.integer_range_excl_value, input_name='integer_range_excl_value'), eol_)) if self.min_max_length_value is not None: showIndent(outfile, level, pretty_print) - outfile.write('<%smin_max_length_value>%s</%smin_max_length_value>%s' % (namespace_, self.gds_encode(self.gds_format_string(quote_xml(self.min_max_length_value), input_name='min_max_length_value')), namespace_, eol_)) + outfile.write('<min_max_length_value>%s</min_max_length_value>%s' % (self.gds_encode(self.gds_format_string(quote_xml(self.min_max_length_value), input_name='min_max_length_value')), eol_)) if self.length_value is not None: showIndent(outfile, level, pretty_print) - outfile.write('<%slength_value>%s</%slength_value>%s' % (namespace_, self.gds_encode(self.gds_format_string(quote_xml(self.length_value), input_name='length_value')), namespace_, eol_)) + outfile.write('<length_value>%s</length_value>%s' % (self.gds_encode(self.gds_format_string(quote_xml(self.length_value), input_name='length_value')), eol_)) if self.totalDigits_value is not None: showIndent(outfile, level, pretty_print) - outfile.write('<%stotalDigits_value>%s</%stotalDigits_value>%s' % (namespace_, self.gds_format_float(self.totalDigits_value, input_name='totalDigits_value'), namespace_, eol_)) + outfile.write('<totalDigits_value>%s</totalDigits_value>%s' % (self.gds_format_float(self.totalDigits_value, input_name='totalDigits_value'), eol_)) if self.date_minincl_value is not None: showIndent(outfile, level, pretty_print) - outfile.write('<%sdate_minincl_value>%s</%sdate_minincl_value>%s' % (namespace_, self.gds_format_date(self.date_minincl_value, input_name='date_minincl_value'), namespace_, eol_)) + outfile.write('<date_minincl_value>%s</date_minincl_value>%s' % (self.gds_format_date(self.date_minincl_value, input_name='date_minincl_value'), eol_)) if self.date_maxincl_value is not None: showIndent(outfile, level, pretty_print) - outfile.write('<%sdate_maxincl_value>%s</%sdate_maxincl_value>%s' % (namespace_, self.gds_format_date(self.date_maxincl_value, input_name='date_maxincl_value'), namespace_, eol_)) + outfile.write('<date_maxincl_value>%s</date_maxincl_value>%s' % (self.gds_format_date(self.date_maxincl_value, input_name='date_maxincl_value'), eol_)) if self.date_minexcl_value is not None: showIndent(outfile, level, pretty_print) - outfile.write('<%sdate_minexcl_value>%s</%sdate_minexcl_value>%s' % (namespace_, self.gds_format_date(self.date_minexcl_value, input_name='date_minexcl_value'), namespace_, eol_)) + outfile.write('<date_minexcl_value>%s</date_minexcl_value>%s' % (self.gds_format_date(self.date_minexcl_value, input_name='date_minexcl_value'), eol_)) if self.date_maxexcl_value is not None: showIndent(outfile, level, pretty_print) - outfile.write('<%sdate_maxexcl_value>%s</%sdate_maxexcl_value>%s' % (namespace_, self.gds_format_date(self.date_maxexcl_value, input_name='date_maxexcl_value'), namespace_, eol_)) + outfile.write('<date_maxexcl_value>%s</date_maxexcl_value>%s' % (self.gds_format_date(self.date_maxexcl_value, input_name='date_maxexcl_value'), eol_)) if self.time_minincl_value is not None: showIndent(outfile, level, pretty_print) - outfile.write('<%stime_minincl_value>%s</%stime_minincl_value>%s' % (namespace_, self.gds_format_time(self.time_minincl_value, input_name='time_minincl_value'), namespace_, eol_)) + outfile.write('<time_minincl_value>%s</time_minincl_value>%s' % (self.gds_format_time(self.time_minincl_value, input_name='time_minincl_value'), eol_)) if self.time_maxincl_value is not None: showIndent(outfile, level, pretty_print) - outfile.write('<%stime_maxincl_value>%s</%stime_maxincl_value>%s' % (namespace_, self.gds_format_time(self.time_maxincl_value, input_name='time_maxincl_value'), namespace_, eol_)) + outfile.write('<time_maxincl_value>%s</time_maxincl_value>%s' % (self.gds_format_time(self.time_maxincl_value, input_name='time_maxincl_value'), eol_)) if self.time_minexcl_value is not None: showIndent(outfile, level, pretty_print) - outfile.write('<%stime_minexcl_value>%s</%stime_minexcl_value>%s' % (namespace_, self.gds_format_time(self.time_minexcl_value, input_name='time_minexcl_value'), namespace_, eol_)) + outfile.write('<time_minexcl_value>%s</time_minexcl_value>%s' % (self.gds_format_time(self.time_minexcl_value, input_name='time_minexcl_value'), eol_)) if self.time_maxexcl_value is not None: showIndent(outfile, level, pretty_print) - outfile.write('<%stime_maxexcl_value>%s</%stime_maxexcl_value>%s' % (namespace_, self.gds_format_time(self.time_maxexcl_value, input_name='time_maxexcl_value'), namespace_, eol_)) + outfile.write('<time_maxexcl_value>%s</time_maxexcl_value>%s' % (self.gds_format_time(self.time_maxexcl_value, input_name='time_maxexcl_value'), eol_)) if self.datetime_minincl_value is not None: showIndent(outfile, level, pretty_print) - outfile.write('<%sdatetime_minincl_value>%s</%sdatetime_minincl_value>%s' % (namespace_, self.gds_format_datetime(self.datetime_minincl_value, input_name='datetime_minincl_value'), namespace_, eol_)) + outfile.write('<datetime_minincl_value>%s</datetime_minincl_value>%s' % (self.gds_format_datetime(self.datetime_minincl_value, input_name='datetime_minincl_value'), eol_)) if self.datetime_maxincl_value is not None: showIndent(outfile, level, pretty_print) - outfile.write('<%sdatetime_maxincl_value>%s</%sdatetime_maxincl_value>%s' % (namespace_, self.gds_format_datetime(self.datetime_maxincl_value, input_name='datetime_maxincl_value'), namespace_, eol_)) + outfile.write('<datetime_maxincl_value>%s</datetime_maxincl_value>%s' % (self.gds_format_datetime(self.datetime_maxincl_value, input_name='datetime_maxincl_value'), eol_)) if self.datetime_minexcl_value is not None: showIndent(outfile, level, pretty_print) - outfile.write('<%sdatetime_minexcl_value>%s</%sdatetime_minexcl_value>%s' % (namespace_, self.gds_format_datetime(self.datetime_minexcl_value, input_name='datetime_minexcl_value'), namespace_, eol_)) + outfile.write('<datetime_minexcl_value>%s</datetime_minexcl_value>%s' % (self.gds_format_datetime(self.datetime_minexcl_value, input_name='datetime_minexcl_value'), eol_)) if self.datetime_maxexcl_value is not None: showIndent(outfile, level, pretty_print) - outfile.write('<%sdatetime_maxexcl_value>%s</%sdatetime_maxexcl_value>%s' % (namespace_, self.gds_format_datetime(self.datetime_maxexcl_value, input_name='datetime_maxexcl_value'), namespace_, eol_)) + outfile.write('<datetime_maxexcl_value>%s</datetime_maxexcl_value>%s' % (self.gds_format_datetime(self.datetime_maxexcl_value, input_name='datetime_maxexcl_value'), eol_)) if self.vbar_pattern_value is not None: showIndent(outfile, level, pretty_print) - outfile.write('<%svbar_pattern_value>%s</%svbar_pattern_value>%s' % (namespace_, self.gds_encode(self.gds_format_string(quote_xml(self.vbar_pattern_value), input_name='vbar_pattern_value')), namespace_, eol_)) + outfile.write('<vbar_pattern_value>%s</vbar_pattern_value>%s' % (self.gds_encode(self.gds_format_string(quote_xml(self.vbar_pattern_value), input_name='vbar_pattern_value')), eol_)) if self.anonymous_float_value is not None: showIndent(outfile, level, pretty_print) - outfile.write('<%sanonymous_float_value>%s</%sanonymous_float_value>%s' % (namespace_, self.gds_format_float(self.anonymous_float_value, input_name='anonymous_float_value'), namespace_, eol_)) + outfile.write('<anonymous_float_value>%s</anonymous_float_value>%s' % (self.gds_format_float(self.anonymous_float_value, input_name='anonymous_float_value'), eol_)) if self.primative_integer is not None: showIndent(outfile, level, pretty_print) - outfile.write('<%sprimative_integer>%s</%sprimative_integer>%s' % (namespace_, self.gds_format_integer(self.primative_integer, input_name='primative_integer'), namespace_, eol_)) + outfile.write('<primative_integer>%s</primative_integer>%s' % (self.gds_format_integer(self.primative_integer, input_name='primative_integer'), eol_)) if self.primative_float is not None: showIndent(outfile, level, pretty_print) - outfile.write('<%sprimative_float>%s</%sprimative_float>%s' % (namespace_, self.gds_format_float(self.primative_float, input_name='primative_float'), namespace_, eol_)) + outfile.write('<primative_float>%s</primative_float>%s' % (self.gds_format_float(self.primative_float, input_name='primative_float'), eol_)) def build(self, node): already_processed = set() self.buildAttributes(node, node.attrib, already_processed) @@ -1624,7 +1624,7 @@ class simpleTwoElementOneType(GeneratedsSuper): eol_ = '' if self.simpleTwoElementTwo is not None: showIndent(outfile, level, pretty_print) - outfile.write('<%ssimpleTwoElementTwo>%s</%ssimpleTwoElementTwo>%s' % (namespace_, self.gds_encode(self.gds_format_string(quote_xml(self.simpleTwoElementTwo), input_name='simpleTwoElementTwo')), namespace_, eol_)) + outfile.write('<simpleTwoElementTwo>%s</simpleTwoElementTwo>%s' % (self.gds_encode(self.gds_format_string(quote_xml(self.simpleTwoElementTwo), input_name='simpleTwoElementTwo')), eol_)) def build(self, node): already_processed = set() self.buildAttributes(node, node.attrib, already_processed) diff --git a/tutorial/generateds_tutorial.txt b/tutorial/generateds_tutorial.txt index 57c3ba7607f242d3c806dac9b29416390af14d3f..e49dea9cbe20cbca39f64c6bd15991297fb93b66 100644 --- a/tutorial/generateds_tutorial.txt +++ b/tutorial/generateds_tutorial.txt @@ -11,7 +11,7 @@ generateDS -- Introduction and Tutorial .. version -:revision: 2.28.2 +:revision: 2.29.0 .. version diff --git a/tutorial/generateds_tutorial.zip b/tutorial/generateds_tutorial.zip index 2ea97e7a994020bce297a78d2458315399e29c27..5df17e9bc8cbf7303ea98cf29479ce020d3d7253 100644 Binary files a/tutorial/generateds_tutorial.zip and b/tutorial/generateds_tutorial.zip differ