diff --git a/README b/README index 295bc42192e31e78687f0feedc21cf249da76544..5e8629c11a7814f8616f0bbf4ee8b3c2b07ddd4f 100644 --- a/README +++ b/README @@ -141,7 +141,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Change history -------------- -Version 2.23c (10/13/2016) +Version 2.23c (11/03/2016) - Added entry_points to setup.py so that distutils will generate executable scripts for executable .py files (for example, @@ -150,6 +150,12 @@ Version 2.23c (10/13/2016) - Fixed function call signature mismatch in MixedContainer call to export method. Thanks to Lev Israel for catching this and providing the solution. +- Fix to catch duplicate definitions of child elements with the same + name inside a single parent element. This fix does the following: + (1) removes duplicate child; (2) makes the remaining child a + Python list (effectively maxOccurs="unbounded"); (3) prints a + warning message when it finds and removes a duplicate. Thanks to + Pietro Saccardi for catching and reporting this. Version 2.23b (09/26/2016) diff --git a/generateDS.py b/generateDS.py index 9aa3fa883b779ddb569d05938a8eb3653163e111..1da2d2f43e333c30377c70e69875e766f41f26ea 100755 --- a/generateDS.py +++ b/generateDS.py @@ -98,6 +98,10 @@ Options: search pattern and second is a replacement. Example: "[('[-:.]', '_'), ('^__', 'Special')]" Default: "[('[-:.]', '_')]" + --remove-duplicate-child-elements + If a child element with the same name is + defined multiple times under a parent, then + remove it and issue a warning. -q, --no-questions Do not ask questions, for example, force overwrite. --session=mysession.session @@ -153,7 +157,6 @@ import sys import os.path import time import getopt -from pprint import pprint if sys.version_info.major == 2: import urllib2 @@ -276,6 +279,7 @@ SingleFileOutput = True OutputDirectory = None ModuleSuffix = "" PreserveCdataTags = False +RemoveDuplicateChildElements = False SchemaToPythonTypeMap = {} @@ -918,7 +922,12 @@ class XschemaElement(XschemaElementBase): self.expandGroupReferences_tree(visited) self.collect_element_dict() self.annotate_find_type() - self.annotate_tree() + element_dict = {} + to_be_removed = [] + self.annotate_tree( + element_dict=element_dict, + to_be_removed=to_be_removed) + self.remove_children(to_be_removed) self.fix_dup_names() self.coerce_attr_types() self.checkMixedBases() @@ -1153,7 +1162,19 @@ class XschemaElement(XschemaElementBase): for child in self.children: child.annotate_find_type() - def annotate_tree(self): + def annotate_tree(self, element_dict, to_be_removed): + if RemoveDuplicateChildElements: + name = self.getName() + if name in element_dict: + # If we've already seen this element (name), make it a + # list and throw the previous one away. + self.maxOccurs = 2 + to_be_removed.append(element_dict[name]) + err_msg( + '*** warning. Removing child with duplicate ' + 'name: "{}"\n'.format(name)) + else: + element_dict[name] = self # If there is a namespace, replace it with an underscore. if self.base: self.base = strip_namespace(self.base) @@ -1193,7 +1214,6 @@ class XschemaElement(XschemaElementBase): sys.exit(1) self.minOccurs = minOccurs self.maxOccurs = maxOccurs - # If it does not have a type, then make the type the same as the name. if self.type == 'NoneType' and self.name: self.type = self.name @@ -1212,8 +1232,21 @@ class XschemaElement(XschemaElementBase): parent.collapseWhiteSpace): self.collapseWhiteSpace = 1 # Do it recursively for all descendents. + element_dict = {} + to_be_removed = [] for child in self.children: - child.annotate_tree() + child.annotate_tree( + element_dict=element_dict, + to_be_removed=to_be_removed) + self.remove_children(to_be_removed) + + def remove_children(self, to_be_removed): + for element in to_be_removed: + if element in self.children: + self.children.remove(element) + else: + err_msg("*** warning. child {} already removed\n".format( + element.getName())) # # For each name in the attributeGroupNameList for this element, @@ -6882,7 +6915,8 @@ def main(): ExportWrite, ExportEtree, ExportLiteral, \ FixTypeNames, SingleFileOutput, OutputDirectory, \ ModuleSuffix, UseOldSimpleTypeValidators, \ - PreserveCdataTags, CleanupNameList + PreserveCdataTags, CleanupNameList, \ + RemoveDuplicateChildElements outputText = True args = sys.argv[1:] try: @@ -6900,6 +6934,7 @@ def main(): 'one-file-per-xsd', 'output-directory=', 'module-suffix=', 'use-old-simpletype-validators', 'preserve-cdata-tags', 'cleanup-name-list=', + 'remove-duplicate-child-elements', ]) except getopt.GetoptError: usage() @@ -7084,6 +7119,8 @@ def main(): PreserveCdataTags = True elif option[0] == '--cleanup-name-list': CleanupNameList = capture_cleanup_name_list(option[1]) + elif option[0] == '--remove-duplicate-child-elements': + RemoveDuplicateChildElements = True if showVersion: print('generateDS.py version %s' % VERSION) sys.exit(0) diff --git a/tests/anywildcard.xsd b/tests/anywildcard.xsd index 2db93a3fd82502b19ee24b9c8c3a6b730e717c1f..9931e20d8ea74b3f6b79c622d9328794d6655891 100644 --- a/tests/anywildcard.xsd +++ b/tests/anywildcard.xsd @@ -48,6 +48,7 @@ <xs:any minOccurs="1" maxOccurs="unbounded"/> </xs:sequence> </xs:complexType> + <!-- <xs:complexType name="DescriptionType"> <xs:annotation> <xs:documentation>A standard complexType.</xs:documentation> @@ -66,4 +67,5 @@ <xs:element name="catagory" type="xs:integer"/> </xs:sequence> </xs:complexType> + --> </xs:schema> diff --git a/tests/simpletypes_other.xsd b/tests/simpletypes_other.xsd index 95eadb5dcb83bf21233b8c481592a817266be1bb..5be7d4ced6eee343b30f5e9cf992ecf7f67bdb76 100644 --- a/tests/simpletypes_other.xsd +++ b/tests/simpletypes_other.xsd @@ -8,12 +8,14 @@ </xs:element> <xs:complexType name="simpleTypeTestsType"> <xs:sequence> - <xs:element name="simpleTypeTest" maxOccurs="unbounded" type="simpleTypeTestType"/> + <xs:element + name="simpleTypeTest" + maxOccurs="unbounded" + type="simpleTypeTestDefs"/> </xs:sequence> </xs:complexType> - <xs:element name="simpleTypeTest" type="simpleTypeTestType"/> - <xs:complexType mixed="0" name="simpleTypeTest"> + <xs:complexType mixed="0" name="simpleTypeTestDefs"> <xs:complexContent> <xs:sequence> <xs:element name="datetime1" type="xs:gYear"/> diff --git a/tests/simpletypes_other1_sub.py b/tests/simpletypes_other1_sub.py index d00c37b5e2c5a6ea48beab1f5cfb8fb32ef54c5b..4792c10dda257425276de50223787e9ecf9fc5a2 100644 --- a/tests/simpletypes_other1_sub.py +++ b/tests/simpletypes_other1_sub.py @@ -54,11 +54,11 @@ supermod.simpleTypeTestsType.subclass = simpleTypeTestsTypeSub # end class simpleTypeTestsTypeSub -class simpleTypeTestSub(supermod.simpleTypeTest): +class simpleTypeTestDefsSub(supermod.simpleTypeTestDefs): def __init__(self, datetime1=None, datetime2=None, datetime3=None, datetime4=None, datetime5=None, integerVal1=None, integerVal2=None, stringVal1=None, stringVal2=None, booleanVal1=None, booleanVal2=None, decimalVal1=None, decimalVal2=None, doubleVal1=None, doubleVal2=None, floatVal1=None, floatVal2=None, dateVal1=None, dateVal2=None, dateTimeVal1=None, dateTimeVal2=None): - super(simpleTypeTestSub, self).__init__(datetime1, datetime2, datetime3, datetime4, datetime5, integerVal1, integerVal2, stringVal1, stringVal2, booleanVal1, booleanVal2, decimalVal1, decimalVal2, doubleVal1, doubleVal2, floatVal1, floatVal2, dateVal1, dateVal2, dateTimeVal1, dateTimeVal2, ) -supermod.simpleTypeTest.subclass = simpleTypeTestSub -# end class simpleTypeTestSub + super(simpleTypeTestDefsSub, self).__init__(datetime1, datetime2, datetime3, datetime4, datetime5, integerVal1, integerVal2, stringVal1, stringVal2, booleanVal1, booleanVal2, decimalVal1, decimalVal2, doubleVal1, doubleVal2, floatVal1, floatVal2, dateVal1, dateVal2, dateTimeVal1, dateTimeVal2, ) +supermod.simpleTypeTestDefs.subclass = simpleTypeTestDefsSub +# end class simpleTypeTestDefsSub def get_root_tag(node): diff --git a/tests/simpletypes_other1_sup.py b/tests/simpletypes_other1_sup.py index 7431c185516534425ad5494a704bf087a405fa5a..2bceefac870e7de446e66478037f04d1bb7c83e6 100644 --- a/tests/simpletypes_other1_sup.py +++ b/tests/simpletypes_other1_sup.py @@ -653,7 +653,7 @@ def _cast(typ, value): class simpleTypeTestsType(GeneratedsSuper): member_data_items_ = [ - MemberSpec_('simpleTypeTest', 'simpleTypeTest', 1), + MemberSpec_('simpleTypeTest', 'simpleTypeTestDefs', 1), ] subclass = None superclass = None @@ -712,8 +712,7 @@ class simpleTypeTestsType(GeneratedsSuper): else: eol_ = '' for simpleTypeTest_ in self.simpleTypeTest: - showIndent(outfile, level, pretty_print) - outfile.write('<%ssimpleTypeTest>%s</%ssimpleTypeTest>%s' % (namespace_, self.gds_encode(self.gds_format_string(quote_xml(simpleTypeTest_), input_name='simpleTypeTest')), namespace_, eol_)) + simpleTypeTest_.export(outfile, level, namespace_, name_='simpleTypeTest', pretty_print=pretty_print) def build(self, node): already_processed = set() self.buildAttributes(node, node.attrib, already_processed) @@ -725,13 +724,14 @@ class simpleTypeTestsType(GeneratedsSuper): pass def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): if nodeName_ == 'simpleTypeTest': - simpleTypeTest_ = child_.text - simpleTypeTest_ = self.gds_validate_string(simpleTypeTest_, node, 'simpleTypeTest') - self.simpleTypeTest.append(simpleTypeTest_) + obj_ = simpleTypeTestDefs.factory() + obj_.build(child_) + self.simpleTypeTest.append(obj_) + obj_.original_tagname_ = 'simpleTypeTest' # end class simpleTypeTestsType -class simpleTypeTest(GeneratedsSuper): +class simpleTypeTestDefs(GeneratedsSuper): member_data_items_ = [ MemberSpec_('datetime1', 'xs:gYear', 0), MemberSpec_('datetime2', 'xs:gYearMonth', 0), @@ -815,13 +815,13 @@ class simpleTypeTest(GeneratedsSuper): def factory(*args_, **kwargs_): if CurrentSubclassModule_ is not None: subclass = getSubclassFromModule_( - CurrentSubclassModule_, simpleTypeTest) + CurrentSubclassModule_, simpleTypeTestDefs) if subclass is not None: return subclass(*args_, **kwargs_) - if simpleTypeTest.subclass: - return simpleTypeTest.subclass(*args_, **kwargs_) + if simpleTypeTestDefs.subclass: + return simpleTypeTestDefs.subclass(*args_, **kwargs_) else: - return simpleTypeTest(*args_, **kwargs_) + return simpleTypeTestDefs(*args_, **kwargs_) factory = staticmethod(factory) def get_datetime1(self): return self.datetime1 def set_datetime1(self, datetime1): self.datetime1 = datetime1 @@ -916,7 +916,7 @@ class simpleTypeTest(GeneratedsSuper): return True else: return False - def export(self, outfile, level, namespace_='', name_='simpleTypeTest', namespacedef_='', pretty_print=True): + def export(self, outfile, level, namespace_='', name_='simpleTypeTestDefs', namespacedef_='', pretty_print=True): if pretty_print: eol_ = '\n' else: @@ -926,17 +926,17 @@ class simpleTypeTest(GeneratedsSuper): 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_='simpleTypeTest') + self.exportAttributes(outfile, level, already_processed, namespace_, name_='simpleTypeTestDefs') if self.hasContent_(): outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='simpleTypeTest', pretty_print=pretty_print) + self.exportChildren(outfile, level + 1, namespace_='', name_='simpleTypeTestDefs', 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_='simpleTypeTest'): + def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='simpleTypeTestDefs'): pass - def exportChildren(self, outfile, level, namespace_='', name_='simpleTypeTest', fromsubclass_=False, pretty_print=True): + def exportChildren(self, outfile, level, namespace_='', name_='simpleTypeTestDefs', fromsubclass_=False, pretty_print=True): if pretty_print: eol_ = '\n' else: @@ -1142,10 +1142,11 @@ class simpleTypeTest(GeneratedsSuper): sval_ = child_.text dval_ = self.gds_parse_datetime(sval_) self.dateTimeVal2.append(dval_) -# end class simpleTypeTest +# end class simpleTypeTestDefs GDSClassesMapping = { + 'simpleTypeTest': simpleTypeTestDefs, 'simpleTypeTests': simpleTypeTestsType, } @@ -1269,6 +1270,6 @@ if __name__ == '__main__': __all__ = [ - "simpleTypeTest", + "simpleTypeTestDefs", "simpleTypeTestsType" ] diff --git a/tests/validate_simpletypes.xsd b/tests/validate_simpletypes.xsd index 2af804dc4b2ab57547b2350ebf495524d5fc51dd..10b92e989a578cbab4b08e16f564dca2d645c35b 100644 --- a/tests/validate_simpletypes.xsd +++ b/tests/validate_simpletypes.xsd @@ -18,7 +18,6 @@ <xs:element name="integer_range_1_value" type="integer_range_1_st"/> <xs:element name="pattern_value" type="pattern_st"/> <xs:element name="token_enum_value" type="token_enum_st"/> - <xs:element name="token_enum_value" type="token_enum_st"/> <xs:element name="integer_range_incl_value" type="integer_range_incl_st"/> <xs:element name="integer_range_excl_value" type="integer_range_excl_st"/> <xs:element name="min_max_length_value" type="min_max_length_st"/> diff --git a/tests/validate_simpletypes1_out.xml b/tests/validate_simpletypes1_out.xml index c64d503f895a974a29eb7f2a47d378c34e78f3df..17031b6e4c8d59c515b7903c2b355d7b9346e9b9 100644 --- a/tests/validate_simpletypes1_out.xml +++ b/tests/validate_simpletypes1_out.xml @@ -4,7 +4,6 @@ <integer_range_1_value>5</integer_range_1_value> <pattern_value>bbbmn456opxxx</pattern_value> <token_enum_value>float</token_enum_value> - <token_enum_value>float</token_enum_value> <integer_range_incl_value>2</integer_range_incl_value> <integer_range_excl_value>7</integer_range_excl_value> <min_max_length_value>abc def ghi</min_max_length_value> @@ -29,7 +28,6 @@ <integer_range_1_value>2</integer_range_1_value> <pattern_value>mmaaa1234mnopzzz</pattern_value> <token_enum_value>floatxx</token_enum_value> - <token_enum_value>floatxx</token_enum_value> <integer_range_incl_value>22</integer_range_incl_value> <integer_range_excl_value>-40</integer_range_excl_value> <min_max_length_value>mno pqr</min_max_length_value> diff --git a/tests/validate_simpletypes1_sup.py b/tests/validate_simpletypes1_sup.py index 3659a7d16792534849d484f4d01d0e99283d58df..4e3ff4bc75155bec5e05ea87a5e4c77323d3cf9c 100644 --- a/tests/validate_simpletypes1_sup.py +++ b/tests/validate_simpletypes1_sup.py @@ -807,7 +807,6 @@ class simpleOneType(GeneratedsSuper): MemberSpec_('integer_range_1_value', ['integer_range_1_st', 'integer_range_2_st', 'xs:integer'], 0), MemberSpec_('pattern_value', ['pattern_st', 'pattern_1_st', 'min_length_st', 'xs:string'], 0), MemberSpec_('token_enum_value', ['token_enum_st', 'xs:NMTOKEN'], 0), - MemberSpec_('token_enum_value', ['token_enum_st', 'xs:NMTOKEN'], 0), MemberSpec_('integer_range_incl_value', ['integer_range_incl_st', 'xs:integer'], 0), MemberSpec_('integer_range_excl_value', ['integer_range_excl_st', 'xs:integer'], 0), MemberSpec_('min_max_length_value', ['min_max_length_st', 'xs:string'], 0), @@ -839,8 +838,6 @@ class simpleOneType(GeneratedsSuper): self.validate_pattern_st(self.pattern_value) self.token_enum_value = token_enum_value self.validate_token_enum_st(self.token_enum_value) - self.token_enum_value = token_enum_value - self.validate_token_enum_st(self.token_enum_value) self.integer_range_incl_value = integer_range_incl_value self.validate_integer_range_incl_st(self.integer_range_incl_value) self.integer_range_excl_value = integer_range_excl_value @@ -932,8 +929,6 @@ class simpleOneType(GeneratedsSuper): def set_pattern_value(self, pattern_value): self.pattern_value = pattern_value def get_token_enum_value(self): return self.token_enum_value def set_token_enum_value(self, token_enum_value): self.token_enum_value = token_enum_value - def get_token_enum_value(self): return self.token_enum_value - def set_token_enum_value(self, token_enum_value): self.token_enum_value = token_enum_value def get_integer_range_incl_value(self): return self.integer_range_incl_value def set_integer_range_incl_value(self, integer_range_incl_value): self.integer_range_incl_value = integer_range_incl_value def get_integer_range_excl_value(self): return self.integer_range_excl_value @@ -1105,7 +1100,6 @@ class simpleOneType(GeneratedsSuper): self.integer_range_1_value is not None or self.pattern_value is not None or self.token_enum_value is not None or - self.token_enum_value is not None or self.integer_range_incl_value is not None or self.integer_range_excl_value is not None or self.min_max_length_value is not None or @@ -1164,9 +1158,6 @@ class simpleOneType(GeneratedsSuper): 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_)) - 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_)) 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_)) @@ -1259,12 +1250,6 @@ class simpleOneType(GeneratedsSuper): self.token_enum_value = token_enum_value_ # validate type token_enum_st self.validate_token_enum_st(self.token_enum_value) - elif nodeName_ == 'token_enum_value': - token_enum_value_ = child_.text - token_enum_value_ = self.gds_validate_string(token_enum_value_, node, 'token_enum_value') - self.token_enum_value = token_enum_value_ - # validate type token_enum_st - self.validate_token_enum_st(self.token_enum_value) elif nodeName_ == 'integer_range_incl_value': sval_ = child_.text try: diff --git a/tests/validate_simpletypes1_warnings.txt b/tests/validate_simpletypes1_warnings.txt index 6f65004dfb076ce9acf5514a3a99a22654fcb508..515f51755555ad3c454b5ec7890354d3622e6b8a 100644 --- a/tests/validate_simpletypes1_warnings.txt +++ b/tests/validate_simpletypes1_warnings.txt @@ -1,58 +1,58 @@ -tests/validate_simpletypes2_sup.py:981: UserWarning: Value "2" does not match xsd minExclusive restriction on integer_range_1_st +tests/validate_simpletypes2_sup.py:976: UserWarning: Value "2" does not match xsd minExclusive restriction on integer_range_1_st warnings_.warn('Value "%(value)s" does not match xsd minExclusive restriction on integer_range_1_st' % {"value" : value} ) -tests/validate_simpletypes2_sup.py:991: UserWarning: Value "mmaaa1234mnopzzz" does not match xsd pattern restrictions: [['^aaa.*zzz$', '^bbb.*xxx$'], ['^.*123.*$', '^.*456.*$']] +tests/validate_simpletypes2_sup.py:986: UserWarning: Value "mmaaa1234mnopzzz" does not match xsd pattern restrictions: [['^aaa.*zzz$', '^bbb.*xxx$'], ['^.*123.*$', '^.*456.*$']] warnings_.warn('Value "%s" does not match xsd pattern restrictions: %s' % (value.encode('utf-8'), self.validate_pattern_st_patterns_, )) -tests/validate_simpletypes2_sup.py:1004: UserWarning: Value "floatxx" does not match xsd enumeration restriction on token_enum_st +tests/validate_simpletypes2_sup.py:999: UserWarning: Value "floatxx" does not match xsd enumeration restriction on token_enum_st warnings_.warn('Value "%(value)s" does not match xsd enumeration restriction on token_enum_st' % {"value" : value.encode("utf-8")} ) -tests/validate_simpletypes2_sup.py:1011: UserWarning: Value "22" does not match xsd maxInclusive restriction on integer_range_incl_st +tests/validate_simpletypes2_sup.py:1006: UserWarning: Value "22" does not match xsd maxInclusive restriction on integer_range_incl_st warnings_.warn('Value "%(value)s" does not match xsd maxInclusive restriction on integer_range_incl_st' % {"value" : value} ) -tests/validate_simpletypes2_sup.py:1016: UserWarning: Value "-40" does not match xsd minExclusive restriction on integer_range_excl_st +tests/validate_simpletypes2_sup.py:1011: UserWarning: Value "-40" does not match xsd minExclusive restriction on integer_range_excl_st warnings_.warn('Value "%(value)s" does not match xsd minExclusive restriction on integer_range_excl_st' % {"value" : value} ) -tests/validate_simpletypes2_sup.py:1025: UserWarning: Value "mno pqr" does not match xsd minLength restriction on min_max_length_st +tests/validate_simpletypes2_sup.py:1020: UserWarning: Value "mno pqr" does not match xsd minLength restriction on min_max_length_st warnings_.warn('Value "%(value)s" does not match xsd minLength restriction on min_max_length_st' % {"value" : value.encode("utf-8")} ) -tests/validate_simpletypes2_sup.py:1030: UserWarning: Value "012345" does not match xsd length restriction on length_st +tests/validate_simpletypes2_sup.py:1025: UserWarning: Value "012345" does not match xsd length restriction on length_st warnings_.warn('Value "%(value)s" does not match xsd length restriction on length_st' % {"value" : value.encode("utf-8")} ) -tests/validate_simpletypes2_sup.py:1100: UserWarning: Value "0.2" does not match xsd minInclusive restriction on anonymous_float_valueType +tests/validate_simpletypes2_sup.py:1095: UserWarning: Value "0.2" does not match xsd minInclusive restriction on anonymous_float_valueType warnings_.warn('Value "%(value)s" does not match xsd minInclusive restriction on anonymous_float_valueType' % {"value" : value} ) -tests/validate_simpletypes2_sup.py:983: UserWarning: Value "9" does not match xsd maxExclusive restriction on integer_range_1_st +tests/validate_simpletypes2_sup.py:978: UserWarning: Value "9" does not match xsd maxExclusive restriction on integer_range_1_st warnings_.warn('Value "%(value)s" does not match xsd maxExclusive restriction on integer_range_1_st' % {"value" : value} ) -tests/validate_simpletypes2_sup.py:991: UserWarning: Value "aaa1234mnopzzzbcd" does not match xsd pattern restrictions: [['^aaa.*zzz$', '^bbb.*xxx$'], ['^.*123.*$', '^.*456.*$']] +tests/validate_simpletypes2_sup.py:986: UserWarning: Value "aaa1234mnopzzzbcd" does not match xsd pattern restrictions: [['^aaa.*zzz$', '^bbb.*xxx$'], ['^.*123.*$', '^.*456.*$']] warnings_.warn('Value "%s" does not match xsd pattern restrictions: %s' % (value.encode('utf-8'), self.validate_pattern_st_patterns_, )) -tests/validate_simpletypes2_sup.py:1009: UserWarning: Value "-50" does not match xsd minInclusive restriction on integer_range_incl_st +tests/validate_simpletypes2_sup.py:1004: UserWarning: Value "-50" does not match xsd minInclusive restriction on integer_range_incl_st warnings_.warn('Value "%(value)s" does not match xsd minInclusive restriction on integer_range_incl_st' % {"value" : value} ) -tests/validate_simpletypes2_sup.py:1023: UserWarning: Value "asdf asdf asdf asdf asdf asdf" does not match xsd maxLength restriction on min_max_length_st +tests/validate_simpletypes2_sup.py:1018: UserWarning: Value "asdf asdf asdf asdf asdf asdf" does not match xsd maxLength restriction on min_max_length_st warnings_.warn('Value "%(value)s" does not match xsd maxLength restriction on min_max_length_st' % {"value" : value.encode("utf-8")} ) -tests/validate_simpletypes2_sup.py:1030: UserWarning: Value "01234567890" does not match xsd length restriction on length_st +tests/validate_simpletypes2_sup.py:1025: UserWarning: Value "01234567890" does not match xsd length restriction on length_st warnings_.warn('Value "%(value)s" does not match xsd length restriction on length_st' % {"value" : value.encode("utf-8")} ) -tests/validate_simpletypes2_sup.py:1040: UserWarning: Value "2015-05-01" does not match xsd minInclusive restriction on date_minincl_st +tests/validate_simpletypes2_sup.py:1035: UserWarning: Value "2015-05-01" does not match xsd minInclusive restriction on date_minincl_st warnings_.warn('Value "%(value)s" does not match xsd minInclusive restriction on date_minincl_st' % {"value" : value} ) -tests/validate_simpletypes2_sup.py:1045: UserWarning: Value "2015-11-01" does not match xsd maxInclusive restriction on date_maxincl_st +tests/validate_simpletypes2_sup.py:1040: UserWarning: Value "2015-11-01" does not match xsd maxInclusive restriction on date_maxincl_st warnings_.warn('Value "%(value)s" does not match xsd maxInclusive restriction on date_maxincl_st' % {"value" : value} ) -tests/validate_simpletypes2_sup.py:1050: UserWarning: Value "2015-05-01" does not match xsd minExclusive restriction on date_minexcl_st +tests/validate_simpletypes2_sup.py:1045: UserWarning: Value "2015-05-01" does not match xsd minExclusive restriction on date_minexcl_st warnings_.warn('Value "%(value)s" does not match xsd minExclusive restriction on date_minexcl_st' % {"value" : value} ) -tests/validate_simpletypes2_sup.py:1055: UserWarning: Value "2015-11-01" does not match xsd maxExclusive restriction on date_maxexcl_st +tests/validate_simpletypes2_sup.py:1050: UserWarning: Value "2015-11-01" does not match xsd maxExclusive restriction on date_maxexcl_st warnings_.warn('Value "%(value)s" does not match xsd maxExclusive restriction on date_maxexcl_st' % {"value" : value} ) -tests/validate_simpletypes2_sup.py:1060: UserWarning: Value "13:30:00" does not match xsd minInclusive restriction on time_minincl_st +tests/validate_simpletypes2_sup.py:1055: UserWarning: Value "13:30:00" does not match xsd minInclusive restriction on time_minincl_st warnings_.warn('Value "%(value)s" does not match xsd minInclusive restriction on time_minincl_st' % {"value" : value} ) -tests/validate_simpletypes2_sup.py:1065: UserWarning: Value "17:00:00" does not match xsd maxInclusive restriction on time_maxincl_st +tests/validate_simpletypes2_sup.py:1060: UserWarning: Value "17:00:00" does not match xsd maxInclusive restriction on time_maxincl_st warnings_.warn('Value "%(value)s" does not match xsd maxInclusive restriction on time_maxincl_st' % {"value" : value} ) -tests/validate_simpletypes2_sup.py:1070: UserWarning: Value "13:30:00" does not match xsd minExclusive restriction on time_minexcl_st +tests/validate_simpletypes2_sup.py:1065: UserWarning: Value "13:30:00" does not match xsd minExclusive restriction on time_minexcl_st warnings_.warn('Value "%(value)s" does not match xsd minExclusive restriction on time_minexcl_st' % {"value" : value} ) -tests/validate_simpletypes2_sup.py:1075: UserWarning: Value "17:00:00" does not match xsd maxExclusive restriction on time_maxexcl_st +tests/validate_simpletypes2_sup.py:1070: UserWarning: Value "17:00:00" does not match xsd maxExclusive restriction on time_maxexcl_st warnings_.warn('Value "%(value)s" does not match xsd maxExclusive restriction on time_maxexcl_st' % {"value" : value} ) -tests/validate_simpletypes2_sup.py:1080: UserWarning: Value "2015-06-01 13:20:10" does not match xsd minInclusive restriction on datetime_minincl_st +tests/validate_simpletypes2_sup.py:1075: UserWarning: Value "2015-06-01 13:20:10" does not match xsd minInclusive restriction on datetime_minincl_st warnings_.warn('Value "%(value)s" does not match xsd minInclusive restriction on datetime_minincl_st' % {"value" : value} ) -tests/validate_simpletypes2_sup.py:1085: UserWarning: Value "2015-11-01 14:20:10" does not match xsd maxInclusive restriction on datetime_maxincl_st +tests/validate_simpletypes2_sup.py:1080: UserWarning: Value "2015-11-01 14:20:10" does not match xsd maxInclusive restriction on datetime_maxincl_st warnings_.warn('Value "%(value)s" does not match xsd maxInclusive restriction on datetime_maxincl_st' % {"value" : value} ) -tests/validate_simpletypes2_sup.py:1090: UserWarning: Value "2015-06-01 13:20:10" does not match xsd minExclusive restriction on datetime_minexcl_st +tests/validate_simpletypes2_sup.py:1085: UserWarning: Value "2015-06-01 13:20:10" does not match xsd minExclusive restriction on datetime_minexcl_st warnings_.warn('Value "%(value)s" does not match xsd minExclusive restriction on datetime_minexcl_st' % {"value" : value} ) -tests/validate_simpletypes2_sup.py:1095: UserWarning: Value "2015-11-01 14:20:10" does not match xsd maxExclusive restriction on datetime_maxexcl_st +tests/validate_simpletypes2_sup.py:1090: UserWarning: Value "2015-11-01 14:20:10" does not match xsd maxExclusive restriction on datetime_maxexcl_st warnings_.warn('Value "%(value)s" does not match xsd maxExclusive restriction on datetime_maxexcl_st' % {"value" : value} ) -tests/validate_simpletypes2_sup.py:1102: UserWarning: Value "6.6" does not match xsd maxInclusive restriction on anonymous_float_valueType +tests/validate_simpletypes2_sup.py:1097: UserWarning: Value "6.6" does not match xsd maxInclusive restriction on anonymous_float_valueType warnings_.warn('Value "%(value)s" does not match xsd maxInclusive restriction on anonymous_float_valueType' % {"value" : value} ) -tests/validate_simpletypes2_sup.py:988: UserWarning: Value "aaa12zzz" does not match xsd minLength restriction on pattern_st +tests/validate_simpletypes2_sup.py:983: UserWarning: Value "aaa12zzz" does not match xsd minLength restriction on pattern_st warnings_.warn('Value "%(value)s" does not match xsd minLength restriction on pattern_st' % {"value" : value} ) -tests/validate_simpletypes2_sup.py:991: UserWarning: Value "aaa12zzz" does not match xsd pattern restrictions: [['^aaa.*zzz$', '^bbb.*xxx$'], ['^.*123.*$', '^.*456.*$']] +tests/validate_simpletypes2_sup.py:986: UserWarning: Value "aaa12zzz" does not match xsd pattern restrictions: [['^aaa.*zzz$', '^bbb.*xxx$'], ['^.*123.*$', '^.*456.*$']] warnings_.warn('Value "%s" does not match xsd pattern restrictions: %s' % (value.encode('utf-8'), self.validate_pattern_st_patterns_, )) -tests/validate_simpletypes2_sup.py:1514: UserWarning: Value "pqrst" does not match xsd minLength restriction on simpleTwoElementTwoType +tests/validate_simpletypes2_sup.py:1499: UserWarning: Value "pqrst" does not match xsd minLength restriction on simpleTwoElementTwoType warnings_.warn('Value "%(value)s" does not match xsd minLength restriction on simpleTwoElementTwoType' % {"value" : value.encode("utf-8")} ) diff --git a/tests/validate_simpletypes2_sup.py b/tests/validate_simpletypes2_sup.py index 3659a7d16792534849d484f4d01d0e99283d58df..4e3ff4bc75155bec5e05ea87a5e4c77323d3cf9c 100644 --- a/tests/validate_simpletypes2_sup.py +++ b/tests/validate_simpletypes2_sup.py @@ -807,7 +807,6 @@ class simpleOneType(GeneratedsSuper): MemberSpec_('integer_range_1_value', ['integer_range_1_st', 'integer_range_2_st', 'xs:integer'], 0), MemberSpec_('pattern_value', ['pattern_st', 'pattern_1_st', 'min_length_st', 'xs:string'], 0), MemberSpec_('token_enum_value', ['token_enum_st', 'xs:NMTOKEN'], 0), - MemberSpec_('token_enum_value', ['token_enum_st', 'xs:NMTOKEN'], 0), MemberSpec_('integer_range_incl_value', ['integer_range_incl_st', 'xs:integer'], 0), MemberSpec_('integer_range_excl_value', ['integer_range_excl_st', 'xs:integer'], 0), MemberSpec_('min_max_length_value', ['min_max_length_st', 'xs:string'], 0), @@ -839,8 +838,6 @@ class simpleOneType(GeneratedsSuper): self.validate_pattern_st(self.pattern_value) self.token_enum_value = token_enum_value self.validate_token_enum_st(self.token_enum_value) - self.token_enum_value = token_enum_value - self.validate_token_enum_st(self.token_enum_value) self.integer_range_incl_value = integer_range_incl_value self.validate_integer_range_incl_st(self.integer_range_incl_value) self.integer_range_excl_value = integer_range_excl_value @@ -932,8 +929,6 @@ class simpleOneType(GeneratedsSuper): def set_pattern_value(self, pattern_value): self.pattern_value = pattern_value def get_token_enum_value(self): return self.token_enum_value def set_token_enum_value(self, token_enum_value): self.token_enum_value = token_enum_value - def get_token_enum_value(self): return self.token_enum_value - def set_token_enum_value(self, token_enum_value): self.token_enum_value = token_enum_value def get_integer_range_incl_value(self): return self.integer_range_incl_value def set_integer_range_incl_value(self, integer_range_incl_value): self.integer_range_incl_value = integer_range_incl_value def get_integer_range_excl_value(self): return self.integer_range_excl_value @@ -1105,7 +1100,6 @@ class simpleOneType(GeneratedsSuper): self.integer_range_1_value is not None or self.pattern_value is not None or self.token_enum_value is not None or - self.token_enum_value is not None or self.integer_range_incl_value is not None or self.integer_range_excl_value is not None or self.min_max_length_value is not None or @@ -1164,9 +1158,6 @@ class simpleOneType(GeneratedsSuper): 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_)) - 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_)) 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_)) @@ -1259,12 +1250,6 @@ class simpleOneType(GeneratedsSuper): self.token_enum_value = token_enum_value_ # validate type token_enum_st self.validate_token_enum_st(self.token_enum_value) - elif nodeName_ == 'token_enum_value': - token_enum_value_ = child_.text - token_enum_value_ = self.gds_validate_string(token_enum_value_, node, 'token_enum_value') - self.token_enum_value = token_enum_value_ - # validate type token_enum_st - self.validate_token_enum_st(self.token_enum_value) elif nodeName_ == 'integer_range_incl_value': sval_ = child_.text try: