#!/usr/bin/env python # -*- coding: utf-8 -*- ''' cv2parser - Carte Vitale 2 XML file parser Parser generated with generateDS. Thanks to Dave Kuhlman. Copyright (C) 2014 Entr'ouvert This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . ''' import sys import re as re_ import base64 import datetime as datetime_ import warnings as warnings_ Validate_simpletypes_ = True etree_ = None Verbose_import_ = False ( XMLParser_import_none, XMLParser_import_lxml, XMLParser_import_elementtree ) = range(3) XMLParser_import_library = None try: # lxml from lxml import etree as etree_ XMLParser_import_library = XMLParser_import_lxml if Verbose_import_: print("running with lxml.etree") except ImportError: try: # cElementTree from Python 2.5+ import xml.etree.cElementTree as etree_ XMLParser_import_library = XMLParser_import_elementtree if Verbose_import_: print("running with cElementTree on Python 2.5+") except ImportError: try: # ElementTree from Python 2.5+ import xml.etree.ElementTree as etree_ XMLParser_import_library = XMLParser_import_elementtree if Verbose_import_: print("running with ElementTree on Python 2.5+") except ImportError: try: # normal cElementTree install import cElementTree as etree_ XMLParser_import_library = XMLParser_import_elementtree if Verbose_import_: print("running with cElementTree") except ImportError: try: # normal ElementTree install import elementtree.ElementTree as etree_ XMLParser_import_library = XMLParser_import_elementtree if Verbose_import_: print("running with ElementTree") except ImportError: raise ImportError( "Failed to import ElementTree from any known place") def parsexml_(*args, **kwargs): if (XMLParser_import_library == XMLParser_import_lxml and 'parser' not in kwargs): # Use the lxml ElementTree compatible parser so that, e.g., # we ignore comments. kwargs['parser'] = etree_.ETCompatXMLParser() doc = etree_.parse(*args, **kwargs) return doc # # User methods # # 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, 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())) # # 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(' -- 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'{(.*)}(.*)') # # Support/utility functions. # def showIndent(outfile, level, pretty_print=True): if pretty_print: for idx in range(level): outfile.write(' ') def quote_xml(inStr): if not inStr: return '' s1 = (isinstance(inStr, basestring) and inStr or '%s' % inStr) s1 = s1.replace('&', '&') s1 = s1.replace('<', '<') s1 = s1.replace('>', '>') return s1 def quote_attrib(inStr): s1 = (isinstance(inStr, basestring) 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): if XMLParser_import_library == XMLParser_import_lxml: msg = '%s (element %s/line %d)' % ( msg, node.tag, node.sourceline, ) else: msg = '%s (element %s)' % (msg, node.tag, ) 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) def exportSimple(self, outfile, level, name): if self.content_type == MixedContainer.TypeString: outfile.write('<%s>%s' % ( self.name, self.value, self.name)) elif self.content_type == MixedContainer.TypeInteger or \ self.content_type == MixedContainer.TypeBoolean: outfile.write('<%s>%d' % ( self.name, self.value, self.name)) elif self.content_type == MixedContainer.TypeFloat or \ self.content_type == MixedContainer.TypeDecimal: outfile.write('<%s>%f' % ( self.name, self.value, self.name)) elif self.content_type == MixedContainer.TypeDouble: outfile.write('<%s>%g' % ( self.name, self.value, self.name)) elif self.content_type == MixedContainer.TypeBase64: outfile.write('<%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): self.name = name self.data_type = data_type self.container = container 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 _cast(typ, value): if typ is None or value is None: return value return typ(value) # # Data representation classes. # class T_AsnDonneesVitale(GeneratedsSuper): subclass = None superclass = None def __init__(self, listeBenef=None, e112=None, tech=None): self.original_tagname_ = None self.listeBenef = listeBenef self.e112 = e112 self.tech = tech def factory(*args_, **kwargs_): if T_AsnDonneesVitale.subclass: return T_AsnDonneesVitale.subclass(*args_, **kwargs_) else: return T_AsnDonneesVitale(*args_, **kwargs_) factory = staticmethod(factory) def get_listeBenef(self): return self.listeBenef def set_listeBenef(self, listeBenef): self.listeBenef = listeBenef def get_e112(self): return self.e112 def set_e112(self, e112): self.e112 = e112 def get_tech(self): return self.tech def set_tech(self, tech): self.tech = tech def hasContent_(self): if ( self.listeBenef is not None or self.e112 is not None or self.tech is not None ): return True else: return False def export(self, outfile, level, namespace_='', name_='T_AsnDonneesVitale', namespacedef_='', pretty_print=True): 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_='T_AsnDonneesVitale') if self.hasContent_(): outfile.write('>%s' % (eol_, )) self.exportChildren(outfile, level + 1, namespace_='', name_='T_AsnDonneesVitale', pretty_print=pretty_print) showIndent(outfile, level, pretty_print) outfile.write('%s' % (namespace_, name_, eol_)) else: outfile.write('/>%s' % (eol_, )) def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='T_AsnDonneesVitale'): pass def exportChildren(self, outfile, level, namespace_='', name_='T_AsnDonneesVitale', fromsubclass_=False, pretty_print=True): if pretty_print: eol_ = '\n' else: eol_ = '' if self.listeBenef is not None: self.listeBenef.export(outfile, level, namespace_, name_='listeBenef', pretty_print=pretty_print) if self.e112 is not None: self.e112.export(outfile, level, namespace_, name_='e112', pretty_print=pretty_print) if self.tech is not None: self.tech.export(outfile, level, namespace_, name_='tech', pretty_print=pretty_print) def exportLiteral(self, outfile, level, name_='T_AsnDonneesVitale'): level += 1 already_processed = set() self.exportLiteralAttributes(outfile, level, already_processed, name_) if self.hasContent_(): self.exportLiteralChildren(outfile, level, name_) def exportLiteralAttributes(self, outfile, level, already_processed, name_): pass def exportLiteralChildren(self, outfile, level, name_): if self.listeBenef is not None: showIndent(outfile, level) outfile.write('listeBenef=model_.listeBenefType(\n') self.listeBenef.exportLiteral(outfile, level, name_='listeBenef') showIndent(outfile, level) outfile.write('),\n') if self.e112 is not None: showIndent(outfile, level) outfile.write('e112=model_.T_AsnE112(\n') self.e112.exportLiteral(outfile, level, name_='e112') showIndent(outfile, level) outfile.write('),\n') if self.tech is not None: showIndent(outfile, level) outfile.write('tech=model_.T_AsnInfosTechniques(\n') self.tech.exportLiteral(outfile, level, name_='tech') showIndent(outfile, level) outfile.write('),\n') 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_ == 'listeBenef': obj_ = listeBenefType.factory() obj_.build(child_) self.listeBenef = obj_ obj_.original_tagname_ = 'listeBenef' elif nodeName_ == 'e112': obj_ = T_AsnE112.factory() obj_.build(child_) self.e112 = obj_ obj_.original_tagname_ = 'e112' elif nodeName_ == 'tech': obj_ = T_AsnInfosTechniques.factory() obj_.build(child_) self.tech = obj_ obj_.original_tagname_ = 'tech' # end class T_AsnDonneesVitale class T_AsnAdresse(GeneratedsSuper): subclass = None superclass = None def __init__(self, ligne1=None, ligne2=None, ligne3=None, ligne4=None, ligne5=None): self.original_tagname_ = None self.ligne1 = ligne1 self.validate_ligne1Type(self.ligne1) self.ligne2 = ligne2 self.validate_ligne2Type(self.ligne2) self.ligne3 = ligne3 self.validate_ligne3Type(self.ligne3) self.ligne4 = ligne4 self.validate_ligne4Type(self.ligne4) self.ligne5 = ligne5 self.validate_ligne5Type(self.ligne5) def factory(*args_, **kwargs_): if T_AsnAdresse.subclass: return T_AsnAdresse.subclass(*args_, **kwargs_) else: return T_AsnAdresse(*args_, **kwargs_) factory = staticmethod(factory) def get_ligne1(self): return self.ligne1 def set_ligne1(self, ligne1): self.ligne1 = ligne1 def get_ligne2(self): return self.ligne2 def set_ligne2(self, ligne2): self.ligne2 = ligne2 def get_ligne3(self): return self.ligne3 def set_ligne3(self, ligne3): self.ligne3 = ligne3 def get_ligne4(self): return self.ligne4 def set_ligne4(self, ligne4): self.ligne4 = ligne4 def get_ligne5(self): return self.ligne5 def set_ligne5(self, ligne5): self.ligne5 = ligne5 def validate_ligne1Type(self, value): # Validate type ligne1Type, a restriction on xsd:string. if value is not None and Validate_simpletypes_: if len(value) > 32: warnings_.warn('Value "%(value)s" does not match xsd maxLength restriction on ligne1Type' % {"value" : value.encode("utf-8")} ) if len(value) < 1: warnings_.warn('Value "%(value)s" does not match xsd minLength restriction on ligne1Type' % {"value" : value.encode("utf-8")} ) def validate_ligne2Type(self, value): # Validate type ligne2Type, a restriction on xsd:string. if value is not None and Validate_simpletypes_: if len(value) > 32: warnings_.warn('Value "%(value)s" does not match xsd maxLength restriction on ligne2Type' % {"value" : value.encode("utf-8")} ) if len(value) < 1: warnings_.warn('Value "%(value)s" does not match xsd minLength restriction on ligne2Type' % {"value" : value.encode("utf-8")} ) def validate_ligne3Type(self, value): # Validate type ligne3Type, a restriction on xsd:string. if value is not None and Validate_simpletypes_: if len(value) > 32: warnings_.warn('Value "%(value)s" does not match xsd maxLength restriction on ligne3Type' % {"value" : value.encode("utf-8")} ) if len(value) < 1: warnings_.warn('Value "%(value)s" does not match xsd minLength restriction on ligne3Type' % {"value" : value.encode("utf-8")} ) def validate_ligne4Type(self, value): # Validate type ligne4Type, a restriction on xsd:string. if value is not None and Validate_simpletypes_: if len(value) > 32: warnings_.warn('Value "%(value)s" does not match xsd maxLength restriction on ligne4Type' % {"value" : value.encode("utf-8")} ) if len(value) < 1: warnings_.warn('Value "%(value)s" does not match xsd minLength restriction on ligne4Type' % {"value" : value.encode("utf-8")} ) def validate_ligne5Type(self, value): # Validate type ligne5Type, a restriction on xsd:string. if value is not None and Validate_simpletypes_: if len(value) > 32: warnings_.warn('Value "%(value)s" does not match xsd maxLength restriction on ligne5Type' % {"value" : value.encode("utf-8")} ) if len(value) < 1: warnings_.warn('Value "%(value)s" does not match xsd minLength restriction on ligne5Type' % {"value" : value.encode("utf-8")} ) def hasContent_(self): if ( self.ligne1 is not None or self.ligne2 is not None or self.ligne3 is not None or self.ligne4 is not None or self.ligne5 is not None ): return True else: return False def export(self, outfile, level, namespace_='', name_='T_AsnAdresse', namespacedef_='', pretty_print=True): 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_='T_AsnAdresse') if self.hasContent_(): outfile.write('>%s' % (eol_, )) self.exportChildren(outfile, level + 1, namespace_='', name_='T_AsnAdresse', pretty_print=pretty_print) showIndent(outfile, level, pretty_print) outfile.write('%s' % (namespace_, name_, eol_)) else: outfile.write('/>%s' % (eol_, )) def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='T_AsnAdresse'): pass def exportChildren(self, outfile, level, namespace_='', name_='T_AsnAdresse', fromsubclass_=False, pretty_print=True): if pretty_print: eol_ = '\n' else: eol_ = '' if self.ligne1 is not None: showIndent(outfile, level, pretty_print) outfile.write('<%sligne1>%s%s' % (namespace_, self.gds_format_string(quote_xml(self.ligne1).encode(ExternalEncoding), input_name='ligne1'), namespace_, eol_)) if self.ligne2 is not None: showIndent(outfile, level, pretty_print) outfile.write('<%sligne2>%s%s' % (namespace_, self.gds_format_string(quote_xml(self.ligne2).encode(ExternalEncoding), input_name='ligne2'), namespace_, eol_)) if self.ligne3 is not None: showIndent(outfile, level, pretty_print) outfile.write('<%sligne3>%s%s' % (namespace_, self.gds_format_string(quote_xml(self.ligne3).encode(ExternalEncoding), input_name='ligne3'), namespace_, eol_)) if self.ligne4 is not None: showIndent(outfile, level, pretty_print) outfile.write('<%sligne4>%s%s' % (namespace_, self.gds_format_string(quote_xml(self.ligne4).encode(ExternalEncoding), input_name='ligne4'), namespace_, eol_)) if self.ligne5 is not None: showIndent(outfile, level, pretty_print) outfile.write('<%sligne5>%s%s' % (namespace_, self.gds_format_string(quote_xml(self.ligne5).encode(ExternalEncoding), input_name='ligne5'), namespace_, eol_)) def exportLiteral(self, outfile, level, name_='T_AsnAdresse'): level += 1 already_processed = set() self.exportLiteralAttributes(outfile, level, already_processed, name_) if self.hasContent_(): self.exportLiteralChildren(outfile, level, name_) def exportLiteralAttributes(self, outfile, level, already_processed, name_): pass def exportLiteralChildren(self, outfile, level, name_): if self.ligne1 is not None: showIndent(outfile, level) outfile.write('ligne1=%s,\n' % quote_python(self.ligne1).encode(ExternalEncoding)) if self.ligne2 is not None: showIndent(outfile, level) outfile.write('ligne2=%s,\n' % quote_python(self.ligne2).encode(ExternalEncoding)) if self.ligne3 is not None: showIndent(outfile, level) outfile.write('ligne3=%s,\n' % quote_python(self.ligne3).encode(ExternalEncoding)) if self.ligne4 is not None: showIndent(outfile, level) outfile.write('ligne4=%s,\n' % quote_python(self.ligne4).encode(ExternalEncoding)) if self.ligne5 is not None: showIndent(outfile, level) outfile.write('ligne5=%s,\n' % quote_python(self.ligne5).encode(ExternalEncoding)) 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_ == 'ligne1': ligne1_ = child_.text ligne1_ = self.gds_validate_string(ligne1_, node, 'ligne1') self.ligne1 = ligne1_ self.validate_ligne1Type(self.ligne1) # validate type ligne1Type elif nodeName_ == 'ligne2': ligne2_ = child_.text ligne2_ = self.gds_validate_string(ligne2_, node, 'ligne2') self.ligne2 = ligne2_ self.validate_ligne2Type(self.ligne2) # validate type ligne2Type elif nodeName_ == 'ligne3': ligne3_ = child_.text ligne3_ = self.gds_validate_string(ligne3_, node, 'ligne3') self.ligne3 = ligne3_ self.validate_ligne3Type(self.ligne3) # validate type ligne3Type elif nodeName_ == 'ligne4': ligne4_ = child_.text ligne4_ = self.gds_validate_string(ligne4_, node, 'ligne4') self.ligne4 = ligne4_ self.validate_ligne4Type(self.ligne4) # validate type ligne4Type elif nodeName_ == 'ligne5': ligne5_ = child_.text ligne5_ = self.gds_validate_string(ligne5_, node, 'ligne5') self.ligne5 = ligne5_ self.validate_ligne5Type(self.ligne5) # validate type ligne5Type # end class T_AsnAdresse class T_AsnIdentification(GeneratedsSuper): subclass = None superclass = None def __init__(self, nomUsuel=None, nomPatronymique=None, prenomUsuel=None, naissance=None, nir=None, adresse=None, rangDeNaissance=None, nirCertifie=None, dateCertification=None): self.original_tagname_ = None self.nomUsuel = nomUsuel self.validate_nomUsuelType(self.nomUsuel) self.nomPatronymique = nomPatronymique self.validate_nomPatronymiqueType(self.nomPatronymique) self.prenomUsuel = prenomUsuel self.validate_prenomUsuelType(self.prenomUsuel) self.naissance = naissance self.nir = nir self.validate_nirType(self.nir) self.adresse = adresse self.rangDeNaissance = rangDeNaissance self.validate_rangDeNaissanceType(self.rangDeNaissance) self.nirCertifie = nirCertifie self.validate_nirCertifieType(self.nirCertifie) self.dateCertification = dateCertification self.validate_T_AsnDate(self.dateCertification) def factory(*args_, **kwargs_): if T_AsnIdentification.subclass: return T_AsnIdentification.subclass(*args_, **kwargs_) else: return T_AsnIdentification(*args_, **kwargs_) factory = staticmethod(factory) def get_nomUsuel(self): return self.nomUsuel def set_nomUsuel(self, nomUsuel): self.nomUsuel = nomUsuel def get_nomPatronymique(self): return self.nomPatronymique def set_nomPatronymique(self, nomPatronymique): self.nomPatronymique = nomPatronymique def get_prenomUsuel(self): return self.prenomUsuel def set_prenomUsuel(self, prenomUsuel): self.prenomUsuel = prenomUsuel def get_naissance(self): return self.naissance def set_naissance(self, naissance): self.naissance = naissance def get_nir(self): return self.nir def set_nir(self, nir): self.nir = nir def get_adresse(self): return self.adresse def set_adresse(self, adresse): self.adresse = adresse def get_rangDeNaissance(self): return self.rangDeNaissance def set_rangDeNaissance(self, rangDeNaissance): self.rangDeNaissance = rangDeNaissance def get_nirCertifie(self): return self.nirCertifie def set_nirCertifie(self, nirCertifie): self.nirCertifie = nirCertifie def get_dateCertification(self): return self.dateCertification def set_dateCertification(self, dateCertification): self.dateCertification = dateCertification def validate_nomUsuelType(self, value): # Validate type nomUsuelType, a restriction on xsd:string. if value is not None and Validate_simpletypes_: if len(value) > 35: warnings_.warn('Value "%(value)s" does not match xsd maxLength restriction on nomUsuelType' % {"value" : value.encode("utf-8")} ) if len(value) < 0: warnings_.warn('Value "%(value)s" does not match xsd minLength restriction on nomUsuelType' % {"value" : value.encode("utf-8")} ) def validate_nomPatronymiqueType(self, value): # Validate type nomPatronymiqueType, a restriction on xsd:string. if value is not None and Validate_simpletypes_: if len(value) > 27: warnings_.warn('Value "%(value)s" does not match xsd maxLength restriction on nomPatronymiqueType' % {"value" : value.encode("utf-8")} ) if len(value) < 1: warnings_.warn('Value "%(value)s" does not match xsd minLength restriction on nomPatronymiqueType' % {"value" : value.encode("utf-8")} ) def validate_prenomUsuelType(self, value): # Validate type prenomUsuelType, a restriction on xsd:string. if value is not None and Validate_simpletypes_: if len(value) > 35: warnings_.warn('Value "%(value)s" does not match xsd maxLength restriction on prenomUsuelType' % {"value" : value.encode("utf-8")} ) if len(value) < 0: warnings_.warn('Value "%(value)s" does not match xsd minLength restriction on prenomUsuelType' % {"value" : value.encode("utf-8")} ) def validate_nirType(self, value): # Validate type nirType, a restriction on xsd:string. if value is not None and Validate_simpletypes_: if len(value) != 16: warnings_.warn('Value "%(value)s" does not match xsd length restriction on nirType' % {"value" : value.encode("utf-8")} ) def validate_rangDeNaissanceType(self, value): # Validate type rangDeNaissanceType, a restriction on xsd:integer. if value is not None and Validate_simpletypes_: if len(str(value)) != 1: warnings_.warn('Value "%(value)s" does not match xsd length restriction on rangDeNaissanceType' % {"value" : value} ) def validate_nirCertifieType(self, value): # Validate type nirCertifieType, a restriction on xsd:string. if value is not None and Validate_simpletypes_: if len(value) != 16: warnings_.warn('Value "%(value)s" does not match xsd length restriction on nirCertifieType' % {"value" : value.encode("utf-8")} ) def validate_T_AsnDate(self, value): # Validate type T_AsnDate, a restriction on xsd:integer. if value is not None and Validate_simpletypes_: if len(str(value)) != 8: warnings_.warn('Value "%(value)s" does not match xsd length restriction on T_AsnDate' % {"value" : value} ) def hasContent_(self): if ( self.nomUsuel is not None or self.nomPatronymique is not None or self.prenomUsuel is not None or self.naissance is not None or self.nir is not None or self.adresse is not None or self.rangDeNaissance is not None or self.nirCertifie is not None or self.dateCertification is not None ): return True else: return False def export(self, outfile, level, namespace_='', name_='T_AsnIdentification', namespacedef_='', pretty_print=True): 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_='T_AsnIdentification') if self.hasContent_(): outfile.write('>%s' % (eol_, )) self.exportChildren(outfile, level + 1, namespace_='', name_='T_AsnIdentification', pretty_print=pretty_print) showIndent(outfile, level, pretty_print) outfile.write('%s' % (namespace_, name_, eol_)) else: outfile.write('/>%s' % (eol_, )) def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='T_AsnIdentification'): pass def exportChildren(self, outfile, level, namespace_='', name_='T_AsnIdentification', fromsubclass_=False, pretty_print=True): if pretty_print: eol_ = '\n' else: eol_ = '' if self.nomUsuel is not None: showIndent(outfile, level, pretty_print) outfile.write('<%snomUsuel>%s%s' % (namespace_, self.gds_format_string(quote_xml(self.nomUsuel).encode(ExternalEncoding), input_name='nomUsuel'), namespace_, eol_)) if self.nomPatronymique is not None: showIndent(outfile, level, pretty_print) outfile.write('<%snomPatronymique>%s%s' % (namespace_, self.gds_format_string(quote_xml(self.nomPatronymique).encode(ExternalEncoding), input_name='nomPatronymique'), namespace_, eol_)) if self.prenomUsuel is not None: showIndent(outfile, level, pretty_print) outfile.write('<%sprenomUsuel>%s%s' % (namespace_, self.gds_format_string(quote_xml(self.prenomUsuel).encode(ExternalEncoding), input_name='prenomUsuel'), namespace_, eol_)) if self.naissance is not None: self.naissance.export(outfile, level, namespace_, name_='naissance', pretty_print=pretty_print) if self.nir is not None: showIndent(outfile, level, pretty_print) outfile.write('<%snir>%s%s' % (namespace_, self.gds_format_string(quote_xml(self.nir).encode(ExternalEncoding), input_name='nir'), namespace_, eol_)) if self.adresse is not None: self.adresse.export(outfile, level, namespace_, name_='adresse', pretty_print=pretty_print) if self.rangDeNaissance is not None: showIndent(outfile, level, pretty_print) outfile.write('<%srangDeNaissance>%s%s' % (namespace_, self.gds_format_integer(self.rangDeNaissance, input_name='rangDeNaissance'), namespace_, eol_)) if self.nirCertifie is not None: showIndent(outfile, level, pretty_print) outfile.write('<%snirCertifie>%s%s' % (namespace_, self.gds_format_string(quote_xml(self.nirCertifie).encode(ExternalEncoding), input_name='nirCertifie'), namespace_, eol_)) if self.dateCertification is not None: showIndent(outfile, level, pretty_print) outfile.write('<%sdateCertification>%s%s' % (namespace_, self.gds_format_integer(self.dateCertification, input_name='dateCertification'), namespace_, eol_)) def exportLiteral(self, outfile, level, name_='T_AsnIdentification'): level += 1 already_processed = set() self.exportLiteralAttributes(outfile, level, already_processed, name_) if self.hasContent_(): self.exportLiteralChildren(outfile, level, name_) def exportLiteralAttributes(self, outfile, level, already_processed, name_): pass def exportLiteralChildren(self, outfile, level, name_): if self.nomUsuel is not None: showIndent(outfile, level) outfile.write('nomUsuel=%s,\n' % quote_python(self.nomUsuel).encode(ExternalEncoding)) if self.nomPatronymique is not None: showIndent(outfile, level) outfile.write('nomPatronymique=%s,\n' % quote_python(self.nomPatronymique).encode(ExternalEncoding)) if self.prenomUsuel is not None: showIndent(outfile, level) outfile.write('prenomUsuel=%s,\n' % quote_python(self.prenomUsuel).encode(ExternalEncoding)) if self.naissance is not None: showIndent(outfile, level) outfile.write('naissance=model_.naissanceType(\n') self.naissance.exportLiteral(outfile, level, name_='naissance') showIndent(outfile, level) outfile.write('),\n') if self.nir is not None: showIndent(outfile, level) outfile.write('nir=%s,\n' % quote_python(self.nir).encode(ExternalEncoding)) if self.adresse is not None: showIndent(outfile, level) outfile.write('adresse=model_.T_AsnAdresse(\n') self.adresse.exportLiteral(outfile, level, name_='adresse') showIndent(outfile, level) outfile.write('),\n') if self.rangDeNaissance is not None: showIndent(outfile, level) outfile.write('rangDeNaissance=%d,\n' % self.rangDeNaissance) if self.nirCertifie is not None: showIndent(outfile, level) outfile.write('nirCertifie=%s,\n' % quote_python(self.nirCertifie).encode(ExternalEncoding)) if self.dateCertification is not None: showIndent(outfile, level) outfile.write('dateCertification=%d,\n' % self.dateCertification) 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_ == 'nomUsuel': nomUsuel_ = child_.text nomUsuel_ = self.gds_validate_string(nomUsuel_, node, 'nomUsuel') self.nomUsuel = nomUsuel_ self.validate_nomUsuelType(self.nomUsuel) # validate type nomUsuelType elif nodeName_ == 'nomPatronymique': nomPatronymique_ = child_.text nomPatronymique_ = self.gds_validate_string(nomPatronymique_, node, 'nomPatronymique') self.nomPatronymique = nomPatronymique_ self.validate_nomPatronymiqueType(self.nomPatronymique) # validate type nomPatronymiqueType elif nodeName_ == 'prenomUsuel': prenomUsuel_ = child_.text prenomUsuel_ = self.gds_validate_string(prenomUsuel_, node, 'prenomUsuel') self.prenomUsuel = prenomUsuel_ self.validate_prenomUsuelType(self.prenomUsuel) # validate type prenomUsuelType elif nodeName_ == 'naissance': obj_ = naissanceType.factory() obj_.build(child_) self.naissance = obj_ obj_.original_tagname_ = 'naissance' elif nodeName_ == 'nir': nir_ = child_.text nir_ = self.gds_validate_string(nir_, node, 'nir') self.nir = nir_ self.validate_nirType(self.nir) # validate type nirType elif nodeName_ == 'adresse': obj_ = T_AsnAdresse.factory() obj_.build(child_) self.adresse = obj_ obj_.original_tagname_ = 'adresse' elif nodeName_ == 'rangDeNaissance': sval_ = child_.text try: ival_ = int(sval_) except (TypeError, ValueError), exp: raise_parse_error(child_, 'requires integer: %s' % exp) ival_ = self.gds_validate_integer(ival_, node, 'rangDeNaissance') self.rangDeNaissance = ival_ self.validate_rangDeNaissanceType(self.rangDeNaissance) # validate type rangDeNaissanceType elif nodeName_ == 'nirCertifie': nirCertifie_ = child_.text nirCertifie_ = self.gds_validate_string(nirCertifie_, node, 'nirCertifie') self.nirCertifie = nirCertifie_ self.validate_nirCertifieType(self.nirCertifie) # validate type nirCertifieType elif nodeName_ == 'dateCertification': sval_ = child_.text try: ival_ = int(sval_) except (TypeError, ValueError), exp: raise_parse_error(child_, 'requires integer: %s' % exp) ival_ = self.gds_validate_integer(ival_, node, 'dateCertification') self.dateCertification = ival_ self.validate_T_AsnDate(self.dateCertification) # validate type T_AsnDate # end class T_AsnIdentification class T_AsnPeriode(GeneratedsSuper): subclass = None superclass = None def __init__(self, debut=None, fin=None): self.original_tagname_ = None self.debut = debut self.validate_T_AsnDate(self.debut) self.fin = fin self.validate_T_AsnDate(self.fin) def factory(*args_, **kwargs_): if T_AsnPeriode.subclass: return T_AsnPeriode.subclass(*args_, **kwargs_) else: return T_AsnPeriode(*args_, **kwargs_) factory = staticmethod(factory) def get_debut(self): return self.debut def set_debut(self, debut): self.debut = debut def get_fin(self): return self.fin def set_fin(self, fin): self.fin = fin def validate_T_AsnDate(self, value): # Validate type T_AsnDate, a restriction on xsd:integer. if value is not None and Validate_simpletypes_: if len(str(value)) != 8: warnings_.warn('Value "%(value)s" does not match xsd length restriction on T_AsnDate' % {"value" : value} ) def hasContent_(self): if ( self.debut is not None or self.fin is not None ): return True else: return False def export(self, outfile, level, namespace_='', name_='T_AsnPeriode', namespacedef_='', pretty_print=True): 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_='T_AsnPeriode') if self.hasContent_(): outfile.write('>%s' % (eol_, )) self.exportChildren(outfile, level + 1, namespace_='', name_='T_AsnPeriode', pretty_print=pretty_print) showIndent(outfile, level, pretty_print) outfile.write('%s' % (namespace_, name_, eol_)) else: outfile.write('/>%s' % (eol_, )) def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='T_AsnPeriode'): pass def exportChildren(self, outfile, level, namespace_='', name_='T_AsnPeriode', fromsubclass_=False, pretty_print=True): if pretty_print: eol_ = '\n' else: eol_ = '' if self.debut is not None: showIndent(outfile, level, pretty_print) outfile.write('<%sdebut>%s%s' % (namespace_, self.gds_format_integer(self.debut, input_name='debut'), namespace_, eol_)) if self.fin is not None: showIndent(outfile, level, pretty_print) outfile.write('<%sfin>%s%s' % (namespace_, self.gds_format_integer(self.fin, input_name='fin'), namespace_, eol_)) def exportLiteral(self, outfile, level, name_='T_AsnPeriode'): level += 1 already_processed = set() self.exportLiteralAttributes(outfile, level, already_processed, name_) if self.hasContent_(): self.exportLiteralChildren(outfile, level, name_) def exportLiteralAttributes(self, outfile, level, already_processed, name_): pass def exportLiteralChildren(self, outfile, level, name_): if self.debut is not None: showIndent(outfile, level) outfile.write('debut=%d,\n' % self.debut) if self.fin is not None: showIndent(outfile, level) outfile.write('fin=%d,\n' % self.fin) 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_ == 'debut': sval_ = child_.text try: ival_ = int(sval_) except (TypeError, ValueError), exp: raise_parse_error(child_, 'requires integer: %s' % exp) ival_ = self.gds_validate_integer(ival_, node, 'debut') self.debut = ival_ self.validate_T_AsnDate(self.debut) # validate type T_AsnDate elif nodeName_ == 'fin': sval_ = child_.text try: ival_ = int(sval_) except (TypeError, ValueError), exp: raise_parse_error(child_, 'requires integer: %s' % exp) ival_ = self.gds_validate_integer(ival_, node, 'fin') self.fin = ival_ self.validate_T_AsnDate(self.fin) # validate type T_AsnDate # end class T_AsnPeriode class T_AsnServiceAMO(GeneratedsSuper): subclass = None superclass = None def __init__(self, codeService=None, periodeService=None): self.original_tagname_ = None self.codeService = codeService self.validate_codeServiceType(self.codeService) self.periodeService = periodeService def factory(*args_, **kwargs_): if T_AsnServiceAMO.subclass: return T_AsnServiceAMO.subclass(*args_, **kwargs_) else: return T_AsnServiceAMO(*args_, **kwargs_) factory = staticmethod(factory) def get_codeService(self): return self.codeService def set_codeService(self, codeService): self.codeService = codeService def get_periodeService(self): return self.periodeService def set_periodeService(self, periodeService): self.periodeService = periodeService def validate_codeServiceType(self, value): # Validate type codeServiceType, a restriction on xsd:integer. if value is not None and Validate_simpletypes_: if len(str(value)) != 2: warnings_.warn('Value "%(value)s" does not match xsd length restriction on codeServiceType' % {"value" : value} ) def hasContent_(self): if ( self.codeService is not None or self.periodeService is not None ): return True else: return False def export(self, outfile, level, namespace_='', name_='T_AsnServiceAMO', namespacedef_='', pretty_print=True): 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_='T_AsnServiceAMO') if self.hasContent_(): outfile.write('>%s' % (eol_, )) self.exportChildren(outfile, level + 1, namespace_='', name_='T_AsnServiceAMO', pretty_print=pretty_print) showIndent(outfile, level, pretty_print) outfile.write('%s' % (namespace_, name_, eol_)) else: outfile.write('/>%s' % (eol_, )) def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='T_AsnServiceAMO'): pass def exportChildren(self, outfile, level, namespace_='', name_='T_AsnServiceAMO', fromsubclass_=False, pretty_print=True): if pretty_print: eol_ = '\n' else: eol_ = '' if self.codeService is not None: showIndent(outfile, level, pretty_print) outfile.write('<%scodeService>%s%s' % (namespace_, self.gds_format_integer(self.codeService, input_name='codeService'), namespace_, eol_)) if self.periodeService is not None: self.periodeService.export(outfile, level, namespace_, name_='periodeService', pretty_print=pretty_print) def exportLiteral(self, outfile, level, name_='T_AsnServiceAMO'): level += 1 already_processed = set() self.exportLiteralAttributes(outfile, level, already_processed, name_) if self.hasContent_(): self.exportLiteralChildren(outfile, level, name_) def exportLiteralAttributes(self, outfile, level, already_processed, name_): pass def exportLiteralChildren(self, outfile, level, name_): if self.codeService is not None: showIndent(outfile, level) outfile.write('codeService=%d,\n' % self.codeService) if self.periodeService is not None: showIndent(outfile, level) outfile.write('periodeService=model_.T_AsnPeriode(\n') self.periodeService.exportLiteral(outfile, level, name_='periodeService') showIndent(outfile, level) outfile.write('),\n') 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_ == 'codeService': sval_ = child_.text try: ival_ = int(sval_) except (TypeError, ValueError), exp: raise_parse_error(child_, 'requires integer: %s' % exp) ival_ = self.gds_validate_integer(ival_, node, 'codeService') self.codeService = ival_ self.validate_codeServiceType(self.codeService) # validate type codeServiceType elif nodeName_ == 'periodeService': obj_ = T_AsnPeriode.factory() obj_.build(child_) self.periodeService = obj_ obj_.original_tagname_ = 'periodeService' # end class T_AsnServiceAMO class T_AsnAMO(GeneratedsSuper): subclass = None superclass = None def __init__(self, qualBenef=None, codeRegime=None, caisse=None, centreGestion=None, codeGestion=None, libelleExo=None, infoCompl=None, centreCarte=None, listePeriodesDroits=None, service=None, medecinTraitant=None): self.original_tagname_ = None self.qualBenef = qualBenef self.validate_qualBenefType(self.qualBenef) self.codeRegime = codeRegime self.validate_codeRegimeType(self.codeRegime) self.caisse = caisse self.validate_caisseType(self.caisse) self.centreGestion = centreGestion self.validate_centreGestionType(self.centreGestion) self.codeGestion = codeGestion self.validate_codeGestionType(self.codeGestion) self.libelleExo = libelleExo self.validate_libelleExoType(self.libelleExo) self.infoCompl = infoCompl self.validate_infoComplType(self.infoCompl) self.centreCarte = centreCarte self.validate_centreCarteType(self.centreCarte) self.listePeriodesDroits = listePeriodesDroits self.service = service self.medecinTraitant = medecinTraitant self.validate_medecinTraitantType(self.medecinTraitant) def factory(*args_, **kwargs_): if T_AsnAMO.subclass: return T_AsnAMO.subclass(*args_, **kwargs_) else: return T_AsnAMO(*args_, **kwargs_) factory = staticmethod(factory) def get_qualBenef(self): return self.qualBenef def set_qualBenef(self, qualBenef): self.qualBenef = qualBenef def get_codeRegime(self): return self.codeRegime def set_codeRegime(self, codeRegime): self.codeRegime = codeRegime def get_caisse(self): return self.caisse def set_caisse(self, caisse): self.caisse = caisse def get_centreGestion(self): return self.centreGestion def set_centreGestion(self, centreGestion): self.centreGestion = centreGestion def get_codeGestion(self): return self.codeGestion def set_codeGestion(self, codeGestion): self.codeGestion = codeGestion def get_libelleExo(self): return self.libelleExo def set_libelleExo(self, libelleExo): self.libelleExo = libelleExo def get_infoCompl(self): return self.infoCompl def set_infoCompl(self, infoCompl): self.infoCompl = infoCompl def get_centreCarte(self): return self.centreCarte def set_centreCarte(self, centreCarte): self.centreCarte = centreCarte def get_listePeriodesDroits(self): return self.listePeriodesDroits def set_listePeriodesDroits(self, listePeriodesDroits): self.listePeriodesDroits = listePeriodesDroits def get_service(self): return self.service def set_service(self, service): self.service = service def get_medecinTraitant(self): return self.medecinTraitant def set_medecinTraitant(self, medecinTraitant): self.medecinTraitant = medecinTraitant def validate_qualBenefType(self, value): # Validate type qualBenefType, a restriction on xsd:integer. if value is not None and Validate_simpletypes_: if len(str(value)) != 1: warnings_.warn('Value "%(value)s" does not match xsd length restriction on qualBenefType' % {"value" : value} ) def validate_codeRegimeType(self, value): # Validate type codeRegimeType, a restriction on xsd:integer. if value is not None and Validate_simpletypes_: if len(str(value)) != 2: warnings_.warn('Value "%(value)s" does not match xsd length restriction on codeRegimeType' % {"value" : value} ) def validate_caisseType(self, value): # Validate type caisseType, a restriction on xsd:integer. if value is not None and Validate_simpletypes_: if len(str(value)) != 3: warnings_.warn('Value "%(value)s" does not match xsd length restriction on caisseType' % {"value" : value} ) def validate_centreGestionType(self, value): # Validate type centreGestionType, a restriction on xsd:integer. if value is not None and Validate_simpletypes_: if len(str(value)) != 4: warnings_.warn('Value "%(value)s" does not match xsd length restriction on centreGestionType' % {"value" : value} ) def validate_codeGestionType(self, value): # Validate type codeGestionType, a restriction on xsd:string. if value is not None and Validate_simpletypes_: if len(value) != 2: warnings_.warn('Value "%(value)s" does not match xsd length restriction on codeGestionType' % {"value" : value.encode("utf-8")} ) def validate_libelleExoType(self, value): # Validate type libelleExoType, a restriction on xsd:string. if value is not None and Validate_simpletypes_: if len(value) > 2000: warnings_.warn('Value "%(value)s" does not match xsd maxLength restriction on libelleExoType' % {"value" : value.encode("utf-8")} ) if len(value) < 1: warnings_.warn('Value "%(value)s" does not match xsd minLength restriction on libelleExoType' % {"value" : value.encode("utf-8")} ) def validate_infoComplType(self, value): # Validate type infoComplType, a restriction on xsd:integer. if value is not None and Validate_simpletypes_: if len(str(value)) != 1: warnings_.warn('Value "%(value)s" does not match xsd length restriction on infoComplType' % {"value" : value} ) def validate_centreCarteType(self, value): # Validate type centreCarteType, a restriction on xsd:integer. if value is not None and Validate_simpletypes_: if len(str(value)) != 4: warnings_.warn('Value "%(value)s" does not match xsd length restriction on centreCarteType' % {"value" : value} ) def validate_medecinTraitantType(self, value): # Validate type medecinTraitantType, a restriction on xsd:string. if value is not None and Validate_simpletypes_: if len(value) > 100: warnings_.warn('Value "%(value)s" does not match xsd maxLength restriction on medecinTraitantType' % {"value" : value.encode("utf-8")} ) if len(value) < 1: warnings_.warn('Value "%(value)s" does not match xsd minLength restriction on medecinTraitantType' % {"value" : value.encode("utf-8")} ) def hasContent_(self): if ( self.qualBenef is not None or self.codeRegime is not None or self.caisse is not None or self.centreGestion is not None or self.codeGestion is not None or self.libelleExo is not None or self.infoCompl is not None or self.centreCarte is not None or self.listePeriodesDroits is not None or self.service is not None or self.medecinTraitant is not None ): return True else: return False def export(self, outfile, level, namespace_='', name_='T_AsnAMO', namespacedef_='', pretty_print=True): 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_='T_AsnAMO') if self.hasContent_(): outfile.write('>%s' % (eol_, )) self.exportChildren(outfile, level + 1, namespace_='', name_='T_AsnAMO', pretty_print=pretty_print) showIndent(outfile, level, pretty_print) outfile.write('%s' % (namespace_, name_, eol_)) else: outfile.write('/>%s' % (eol_, )) def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='T_AsnAMO'): pass def exportChildren(self, outfile, level, namespace_='', name_='T_AsnAMO', fromsubclass_=False, pretty_print=True): if pretty_print: eol_ = '\n' else: eol_ = '' if self.qualBenef is not None: showIndent(outfile, level, pretty_print) outfile.write('<%squalBenef>%s%s' % (namespace_, self.gds_format_integer(self.qualBenef, input_name='qualBenef'), namespace_, eol_)) if self.codeRegime is not None: showIndent(outfile, level, pretty_print) outfile.write('<%scodeRegime>%s%s' % (namespace_, self.gds_format_integer(self.codeRegime, input_name='codeRegime'), namespace_, eol_)) if self.caisse is not None: showIndent(outfile, level, pretty_print) outfile.write('<%scaisse>%s%s' % (namespace_, self.gds_format_integer(self.caisse, input_name='caisse'), namespace_, eol_)) if self.centreGestion is not None: showIndent(outfile, level, pretty_print) outfile.write('<%scentreGestion>%s%s' % (namespace_, self.gds_format_integer(self.centreGestion, input_name='centreGestion'), namespace_, eol_)) if self.codeGestion is not None: showIndent(outfile, level, pretty_print) outfile.write('<%scodeGestion>%s%s' % (namespace_, self.gds_format_string(quote_xml(self.codeGestion).encode(ExternalEncoding), input_name='codeGestion'), namespace_, eol_)) if self.libelleExo is not None: showIndent(outfile, level, pretty_print) outfile.write('<%slibelleExo>%s%s' % (namespace_, self.gds_format_string(quote_xml(self.libelleExo).encode(ExternalEncoding), input_name='libelleExo'), namespace_, eol_)) if self.infoCompl is not None: showIndent(outfile, level, pretty_print) outfile.write('<%sinfoCompl>%s%s' % (namespace_, self.gds_format_integer(self.infoCompl, input_name='infoCompl'), namespace_, eol_)) if self.centreCarte is not None: showIndent(outfile, level, pretty_print) outfile.write('<%scentreCarte>%s%s' % (namespace_, self.gds_format_integer(self.centreCarte, input_name='centreCarte'), namespace_, eol_)) if self.listePeriodesDroits is not None: self.listePeriodesDroits.export(outfile, level, namespace_, name_='listePeriodesDroits', pretty_print=pretty_print) if self.service is not None: self.service.export(outfile, level, namespace_, name_='service', pretty_print=pretty_print) if self.medecinTraitant is not None: showIndent(outfile, level, pretty_print) outfile.write('<%smedecinTraitant>%s%s' % (namespace_, self.gds_format_string(quote_xml(self.medecinTraitant).encode(ExternalEncoding), input_name='medecinTraitant'), namespace_, eol_)) def exportLiteral(self, outfile, level, name_='T_AsnAMO'): level += 1 already_processed = set() self.exportLiteralAttributes(outfile, level, already_processed, name_) if self.hasContent_(): self.exportLiteralChildren(outfile, level, name_) def exportLiteralAttributes(self, outfile, level, already_processed, name_): pass def exportLiteralChildren(self, outfile, level, name_): if self.qualBenef is not None: showIndent(outfile, level) outfile.write('qualBenef=%d,\n' % self.qualBenef) if self.codeRegime is not None: showIndent(outfile, level) outfile.write('codeRegime=%d,\n' % self.codeRegime) if self.caisse is not None: showIndent(outfile, level) outfile.write('caisse=%d,\n' % self.caisse) if self.centreGestion is not None: showIndent(outfile, level) outfile.write('centreGestion=%d,\n' % self.centreGestion) if self.codeGestion is not None: showIndent(outfile, level) outfile.write('codeGestion=%s,\n' % quote_python(self.codeGestion).encode(ExternalEncoding)) if self.libelleExo is not None: showIndent(outfile, level) outfile.write('libelleExo=%s,\n' % quote_python(self.libelleExo).encode(ExternalEncoding)) if self.infoCompl is not None: showIndent(outfile, level) outfile.write('infoCompl=%d,\n' % self.infoCompl) if self.centreCarte is not None: showIndent(outfile, level) outfile.write('centreCarte=%d,\n' % self.centreCarte) if self.listePeriodesDroits is not None: showIndent(outfile, level) outfile.write('listePeriodesDroits=model_.listePeriodesDroitsType(\n') self.listePeriodesDroits.exportLiteral(outfile, level, name_='listePeriodesDroits') showIndent(outfile, level) outfile.write('),\n') if self.service is not None: showIndent(outfile, level) outfile.write('service=model_.T_AsnServiceAMO(\n') self.service.exportLiteral(outfile, level, name_='service') showIndent(outfile, level) outfile.write('),\n') if self.medecinTraitant is not None: showIndent(outfile, level) outfile.write('medecinTraitant=%s,\n' % quote_python(self.medecinTraitant).encode(ExternalEncoding)) 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_ == 'qualBenef': sval_ = child_.text try: ival_ = int(sval_) except (TypeError, ValueError), exp: raise_parse_error(child_, 'requires integer: %s' % exp) ival_ = self.gds_validate_integer(ival_, node, 'qualBenef') self.qualBenef = ival_ self.validate_qualBenefType(self.qualBenef) # validate type qualBenefType elif nodeName_ == 'codeRegime': sval_ = child_.text try: ival_ = int(sval_) except (TypeError, ValueError), exp: raise_parse_error(child_, 'requires integer: %s' % exp) ival_ = self.gds_validate_integer(ival_, node, 'codeRegime') self.codeRegime = ival_ self.validate_codeRegimeType(self.codeRegime) # validate type codeRegimeType elif nodeName_ == 'caisse': sval_ = child_.text try: ival_ = int(sval_) except (TypeError, ValueError), exp: raise_parse_error(child_, 'requires integer: %s' % exp) ival_ = self.gds_validate_integer(ival_, node, 'caisse') self.caisse = ival_ self.validate_caisseType(self.caisse) # validate type caisseType elif nodeName_ == 'centreGestion': sval_ = child_.text try: ival_ = int(sval_) except (TypeError, ValueError), exp: raise_parse_error(child_, 'requires integer: %s' % exp) ival_ = self.gds_validate_integer(ival_, node, 'centreGestion') self.centreGestion = ival_ self.validate_centreGestionType(self.centreGestion) # validate type centreGestionType elif nodeName_ == 'codeGestion': codeGestion_ = child_.text codeGestion_ = self.gds_validate_string(codeGestion_, node, 'codeGestion') self.codeGestion = codeGestion_ self.validate_codeGestionType(self.codeGestion) # validate type codeGestionType elif nodeName_ == 'libelleExo': libelleExo_ = child_.text libelleExo_ = self.gds_validate_string(libelleExo_, node, 'libelleExo') self.libelleExo = libelleExo_ self.validate_libelleExoType(self.libelleExo) # validate type libelleExoType elif nodeName_ == 'infoCompl': sval_ = child_.text try: ival_ = int(sval_) except (TypeError, ValueError), exp: raise_parse_error(child_, 'requires integer: %s' % exp) ival_ = self.gds_validate_integer(ival_, node, 'infoCompl') self.infoCompl = ival_ self.validate_infoComplType(self.infoCompl) # validate type infoComplType elif nodeName_ == 'centreCarte': sval_ = child_.text try: ival_ = int(sval_) except (TypeError, ValueError), exp: raise_parse_error(child_, 'requires integer: %s' % exp) ival_ = self.gds_validate_integer(ival_, node, 'centreCarte') self.centreCarte = ival_ self.validate_centreCarteType(self.centreCarte) # validate type centreCarteType elif nodeName_ == 'listePeriodesDroits': obj_ = listePeriodesDroitsType.factory() obj_.build(child_) self.listePeriodesDroits = obj_ obj_.original_tagname_ = 'listePeriodesDroits' elif nodeName_ == 'service': obj_ = T_AsnServiceAMO.factory() obj_.build(child_) self.service = obj_ obj_.original_tagname_ = 'service' elif nodeName_ == 'medecinTraitant': medecinTraitant_ = child_.text medecinTraitant_ = self.gds_validate_string(medecinTraitant_, node, 'medecinTraitant') self.medecinTraitant = medecinTraitant_ self.validate_medecinTraitantType(self.medecinTraitant) # validate type medecinTraitantType # end class T_AsnAMO class T_AsnServices(GeneratedsSuper): subclass = None superclass = None def __init__(self, typeService=None, servicesAssocies=None): self.original_tagname_ = None self.typeService = typeService self.validate_typeServiceType(self.typeService) self.servicesAssocies = servicesAssocies self.validate_servicesAssociesType(self.servicesAssocies) def factory(*args_, **kwargs_): if T_AsnServices.subclass: return T_AsnServices.subclass(*args_, **kwargs_) else: return T_AsnServices(*args_, **kwargs_) factory = staticmethod(factory) def get_typeService(self): return self.typeService def set_typeService(self, typeService): self.typeService = typeService def get_servicesAssocies(self): return self.servicesAssocies def set_servicesAssocies(self, servicesAssocies): self.servicesAssocies = servicesAssocies def validate_typeServiceType(self, value): # Validate type typeServiceType, a restriction on xsd:string. if value is not None and Validate_simpletypes_: if len(value) != 1: warnings_.warn('Value "%(value)s" does not match xsd length restriction on typeServiceType' % {"value" : value.encode("utf-8")} ) def validate_servicesAssociesType(self, value): # Validate type servicesAssociesType, a restriction on xsd:string. if value is not None and Validate_simpletypes_: if len(value) != 17: warnings_.warn('Value "%(value)s" does not match xsd length restriction on servicesAssociesType' % {"value" : value.encode("utf-8")} ) def hasContent_(self): if ( self.typeService is not None or self.servicesAssocies is not None ): return True else: return False def export(self, outfile, level, namespace_='', name_='T_AsnServices', namespacedef_='', pretty_print=True): 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_='T_AsnServices') if self.hasContent_(): outfile.write('>%s' % (eol_, )) self.exportChildren(outfile, level + 1, namespace_='', name_='T_AsnServices', pretty_print=pretty_print) showIndent(outfile, level, pretty_print) outfile.write('%s' % (namespace_, name_, eol_)) else: outfile.write('/>%s' % (eol_, )) def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='T_AsnServices'): pass def exportChildren(self, outfile, level, namespace_='', name_='T_AsnServices', fromsubclass_=False, pretty_print=True): if pretty_print: eol_ = '\n' else: eol_ = '' if self.typeService is not None: showIndent(outfile, level, pretty_print) outfile.write('<%stypeService>%s%s' % (namespace_, self.gds_format_string(quote_xml(self.typeService).encode(ExternalEncoding), input_name='typeService'), namespace_, eol_)) if self.servicesAssocies is not None: showIndent(outfile, level, pretty_print) outfile.write('<%sservicesAssocies>%s%s' % (namespace_, self.gds_format_string(quote_xml(self.servicesAssocies).encode(ExternalEncoding), input_name='servicesAssocies'), namespace_, eol_)) def exportLiteral(self, outfile, level, name_='T_AsnServices'): level += 1 already_processed = set() self.exportLiteralAttributes(outfile, level, already_processed, name_) if self.hasContent_(): self.exportLiteralChildren(outfile, level, name_) def exportLiteralAttributes(self, outfile, level, already_processed, name_): pass def exportLiteralChildren(self, outfile, level, name_): if self.typeService is not None: showIndent(outfile, level) outfile.write('typeService=%s,\n' % quote_python(self.typeService).encode(ExternalEncoding)) if self.servicesAssocies is not None: showIndent(outfile, level) outfile.write('servicesAssocies=%s,\n' % quote_python(self.servicesAssocies).encode(ExternalEncoding)) 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_ == 'typeService': typeService_ = child_.text typeService_ = self.gds_validate_string(typeService_, node, 'typeService') self.typeService = typeService_ self.validate_typeServiceType(self.typeService) # validate type typeServiceType elif nodeName_ == 'servicesAssocies': servicesAssocies_ = child_.text servicesAssocies_ = self.gds_validate_string(servicesAssocies_, node, 'servicesAssocies') self.servicesAssocies = servicesAssocies_ self.validate_servicesAssociesType(self.servicesAssocies) # validate type servicesAssociesType # end class T_AsnServices class T_AsnMutuelle(GeneratedsSuper): subclass = None superclass = None def __init__(self, listeTypeContrat=None, numIdent=None, services=None, listePeriodes=None, indicTraitement=None, codeSTS=None, donneesCompl=None): self.original_tagname_ = None self.listeTypeContrat = listeTypeContrat self.numIdent = numIdent self.validate_numIdentType(self.numIdent) self.services = services self.listePeriodes = listePeriodes self.indicTraitement = indicTraitement self.validate_indicTraitementType(self.indicTraitement) self.codeSTS = codeSTS self.donneesCompl = donneesCompl self.validate_donneesComplType(self.donneesCompl) def factory(*args_, **kwargs_): if T_AsnMutuelle.subclass: return T_AsnMutuelle.subclass(*args_, **kwargs_) else: return T_AsnMutuelle(*args_, **kwargs_) factory = staticmethod(factory) def get_listeTypeContrat(self): return self.listeTypeContrat def set_listeTypeContrat(self, listeTypeContrat): self.listeTypeContrat = listeTypeContrat def get_numIdent(self): return self.numIdent def set_numIdent(self, numIdent): self.numIdent = numIdent def get_services(self): return self.services def set_services(self, services): self.services = services def get_listePeriodes(self): return self.listePeriodes def set_listePeriodes(self, listePeriodes): self.listePeriodes = listePeriodes def get_indicTraitement(self): return self.indicTraitement def set_indicTraitement(self, indicTraitement): self.indicTraitement = indicTraitement def get_codeSTS(self): return self.codeSTS def set_codeSTS(self, codeSTS): self.codeSTS = codeSTS def get_donneesCompl(self): return self.donneesCompl def set_donneesCompl(self, donneesCompl): self.donneesCompl = donneesCompl def validate_numIdentType(self, value): # Validate type numIdentType, a restriction on xsd:string. if value is not None and Validate_simpletypes_: if len(value) != 8: warnings_.warn('Value "%(value)s" does not match xsd length restriction on numIdentType' % {"value" : value.encode("utf-8")} ) def validate_indicTraitementType(self, value): # Validate type indicTraitementType, a restriction on xsd:integer. if value is not None and Validate_simpletypes_: if len(str(value)) != 2: warnings_.warn('Value "%(value)s" does not match xsd length restriction on indicTraitementType' % {"value" : value} ) def validate_donneesComplType(self, value): # Validate type donneesComplType, a restriction on xsd:string. if value is not None and Validate_simpletypes_: if len(value) != 115: warnings_.warn('Value "%(value)s" does not match xsd length restriction on donneesComplType' % {"value" : value.encode("utf-8")} ) def hasContent_(self): if ( self.listeTypeContrat is not None or self.numIdent is not None or self.services is not None or self.listePeriodes is not None or self.indicTraitement is not None or self.codeSTS is not None or self.donneesCompl is not None ): return True else: return False def export(self, outfile, level, namespace_='', name_='T_AsnMutuelle', namespacedef_='', pretty_print=True): 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_='T_AsnMutuelle') if self.hasContent_(): outfile.write('>%s' % (eol_, )) self.exportChildren(outfile, level + 1, namespace_='', name_='T_AsnMutuelle', pretty_print=pretty_print) showIndent(outfile, level, pretty_print) outfile.write('%s' % (namespace_, name_, eol_)) else: outfile.write('/>%s' % (eol_, )) def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='T_AsnMutuelle'): pass def exportChildren(self, outfile, level, namespace_='', name_='T_AsnMutuelle', fromsubclass_=False, pretty_print=True): if pretty_print: eol_ = '\n' else: eol_ = '' if self.listeTypeContrat is not None: self.listeTypeContrat.export(outfile, level, namespace_, name_='listeTypeContrat', pretty_print=pretty_print) if self.numIdent is not None: showIndent(outfile, level, pretty_print) outfile.write('<%snumIdent>%s%s' % (namespace_, self.gds_format_string(quote_xml(self.numIdent).encode(ExternalEncoding), input_name='numIdent'), namespace_, eol_)) if self.services is not None: self.services.export(outfile, level, namespace_, name_='services', pretty_print=pretty_print) if self.listePeriodes is not None: self.listePeriodes.export(outfile, level, namespace_, name_='listePeriodes', pretty_print=pretty_print) if self.indicTraitement is not None: showIndent(outfile, level, pretty_print) outfile.write('<%sindicTraitement>%s%s' % (namespace_, self.gds_format_integer(self.indicTraitement, input_name='indicTraitement'), namespace_, eol_)) if self.codeSTS is not None: showIndent(outfile, level, pretty_print) outfile.write('<%scodeSTS>%s%s' % (namespace_, self.gds_format_integer(self.codeSTS, input_name='codeSTS'), namespace_, eol_)) if self.donneesCompl is not None: showIndent(outfile, level, pretty_print) outfile.write('<%sdonneesCompl>%s%s' % (namespace_, self.gds_format_string(quote_xml(self.donneesCompl).encode(ExternalEncoding), input_name='donneesCompl'), namespace_, eol_)) def exportLiteral(self, outfile, level, name_='T_AsnMutuelle'): level += 1 already_processed = set() self.exportLiteralAttributes(outfile, level, already_processed, name_) if self.hasContent_(): self.exportLiteralChildren(outfile, level, name_) def exportLiteralAttributes(self, outfile, level, already_processed, name_): pass def exportLiteralChildren(self, outfile, level, name_): if self.listeTypeContrat is not None: showIndent(outfile, level) outfile.write('listeTypeContrat=model_.listeTypeContratType(\n') self.listeTypeContrat.exportLiteral(outfile, level, name_='listeTypeContrat') showIndent(outfile, level) outfile.write('),\n') if self.numIdent is not None: showIndent(outfile, level) outfile.write('numIdent=%s,\n' % quote_python(self.numIdent).encode(ExternalEncoding)) if self.services is not None: showIndent(outfile, level) outfile.write('services=model_.T_AsnServices(\n') self.services.exportLiteral(outfile, level, name_='services') showIndent(outfile, level) outfile.write('),\n') if self.listePeriodes is not None: showIndent(outfile, level) outfile.write('listePeriodes=model_.listePeriodesType(\n') self.listePeriodes.exportLiteral(outfile, level, name_='listePeriodes') showIndent(outfile, level) outfile.write('),\n') if self.indicTraitement is not None: showIndent(outfile, level) outfile.write('indicTraitement=%d,\n' % self.indicTraitement) if self.codeSTS is not None: showIndent(outfile, level) outfile.write('codeSTS=%d,\n' % self.codeSTS) if self.donneesCompl is not None: showIndent(outfile, level) outfile.write('donneesCompl=%s,\n' % quote_python(self.donneesCompl).encode(ExternalEncoding)) 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_ == 'listeTypeContrat': obj_ = listeTypeContratType.factory() obj_.build(child_) self.listeTypeContrat = obj_ obj_.original_tagname_ = 'listeTypeContrat' elif nodeName_ == 'numIdent': numIdent_ = child_.text numIdent_ = self.gds_validate_string(numIdent_, node, 'numIdent') self.numIdent = numIdent_ self.validate_numIdentType(self.numIdent) # validate type numIdentType elif nodeName_ == 'services': obj_ = T_AsnServices.factory() obj_.build(child_) self.services = obj_ obj_.original_tagname_ = 'services' elif nodeName_ == 'listePeriodes': obj_ = listePeriodesType.factory() obj_.build(child_) self.listePeriodes = obj_ obj_.original_tagname_ = 'listePeriodes' elif nodeName_ == 'indicTraitement': sval_ = child_.text try: ival_ = int(sval_) except (TypeError, ValueError), exp: raise_parse_error(child_, 'requires integer: %s' % exp) ival_ = self.gds_validate_integer(ival_, node, 'indicTraitement') self.indicTraitement = ival_ self.validate_indicTraitementType(self.indicTraitement) # validate type indicTraitementType elif nodeName_ == 'codeSTS': sval_ = child_.text try: ival_ = int(sval_) except (TypeError, ValueError), exp: raise_parse_error(child_, 'requires integer: %s' % exp) ival_ = self.gds_validate_integer(ival_, node, 'codeSTS') self.codeSTS = ival_ elif nodeName_ == 'donneesCompl': donneesCompl_ = child_.text donneesCompl_ = self.gds_validate_string(donneesCompl_, node, 'donneesCompl') self.donneesCompl = donneesCompl_ self.validate_donneesComplType(self.donneesCompl) # validate type donneesComplType # end class T_AsnMutuelle class T_AsnAMC(GeneratedsSuper): subclass = None superclass = None def __init__(self, numComplB2=None, numComplEDI=None, numAdherent=None, indicTraitement=None, validiteDonnees=None, codeRoutageFlux=None, identHote=None, nomDomaine=None, codeSTS=None, services=None, donneesCompl=None): self.original_tagname_ = None self.numComplB2 = numComplB2 self.validate_numComplB2Type(self.numComplB2) self.numComplEDI = numComplEDI self.validate_numComplEDIType(self.numComplEDI) self.numAdherent = numAdherent self.validate_numAdherentType(self.numAdherent) self.indicTraitement = indicTraitement self.validate_indicTraitementType1(self.indicTraitement) self.validiteDonnees = validiteDonnees self.codeRoutageFlux = codeRoutageFlux self.validate_codeRoutageFluxType(self.codeRoutageFlux) self.identHote = identHote self.validate_identHoteType(self.identHote) self.nomDomaine = nomDomaine self.validate_nomDomaineType(self.nomDomaine) self.codeSTS = codeSTS self.validate_codeSTSType(self.codeSTS) self.services = services self.donneesCompl = donneesCompl self.validate_donneesComplType2(self.donneesCompl) def factory(*args_, **kwargs_): if T_AsnAMC.subclass: return T_AsnAMC.subclass(*args_, **kwargs_) else: return T_AsnAMC(*args_, **kwargs_) factory = staticmethod(factory) def get_numComplB2(self): return self.numComplB2 def set_numComplB2(self, numComplB2): self.numComplB2 = numComplB2 def get_numComplEDI(self): return self.numComplEDI def set_numComplEDI(self, numComplEDI): self.numComplEDI = numComplEDI def get_numAdherent(self): return self.numAdherent def set_numAdherent(self, numAdherent): self.numAdherent = numAdherent def get_indicTraitement(self): return self.indicTraitement def set_indicTraitement(self, indicTraitement): self.indicTraitement = indicTraitement def get_validiteDonnees(self): return self.validiteDonnees def set_validiteDonnees(self, validiteDonnees): self.validiteDonnees = validiteDonnees def get_codeRoutageFlux(self): return self.codeRoutageFlux def set_codeRoutageFlux(self, codeRoutageFlux): self.codeRoutageFlux = codeRoutageFlux def get_identHote(self): return self.identHote def set_identHote(self, identHote): self.identHote = identHote def get_nomDomaine(self): return self.nomDomaine def set_nomDomaine(self, nomDomaine): self.nomDomaine = nomDomaine def get_codeSTS(self): return self.codeSTS def set_codeSTS(self, codeSTS): self.codeSTS = codeSTS def get_services(self): return self.services def set_services(self, services): self.services = services def get_donneesCompl(self): return self.donneesCompl def set_donneesCompl(self, donneesCompl): self.donneesCompl = donneesCompl def validate_numComplB2Type(self, value): # Validate type numComplB2Type, a restriction on xsd:string. if value is not None and Validate_simpletypes_: if len(value) != 10: warnings_.warn('Value "%(value)s" does not match xsd length restriction on numComplB2Type' % {"value" : value.encode("utf-8")} ) def validate_numComplEDIType(self, value): # Validate type numComplEDIType, a restriction on xsd:string. if value is not None and Validate_simpletypes_: if len(value) != 19: warnings_.warn('Value "%(value)s" does not match xsd length restriction on numComplEDIType' % {"value" : value.encode("utf-8")} ) def validate_numAdherentType(self, value): # Validate type numAdherentType, a restriction on xsd:string. if value is not None and Validate_simpletypes_: if len(value) != 8: warnings_.warn('Value "%(value)s" does not match xsd length restriction on numAdherentType' % {"value" : value.encode("utf-8")} ) def validate_indicTraitementType1(self, value): # Validate type indicTraitementType1, a restriction on xsd:integer. if value is not None and Validate_simpletypes_: if len(str(value)) != 2: warnings_.warn('Value "%(value)s" does not match xsd length restriction on indicTraitementType1' % {"value" : value} ) def validate_codeRoutageFluxType(self, value): # Validate type codeRoutageFluxType, a restriction on xsd:string. if value is not None and Validate_simpletypes_: if len(value) != 2: warnings_.warn('Value "%(value)s" does not match xsd length restriction on codeRoutageFluxType' % {"value" : value.encode("utf-8")} ) def validate_identHoteType(self, value): # Validate type identHoteType, a restriction on xsd:string. if value is not None and Validate_simpletypes_: if len(value) != 3: warnings_.warn('Value "%(value)s" does not match xsd length restriction on identHoteType' % {"value" : value.encode("utf-8")} ) def validate_nomDomaineType(self, value): # Validate type nomDomaineType, a restriction on xsd:string. if value is not None and Validate_simpletypes_: if len(value) != 20: warnings_.warn('Value "%(value)s" does not match xsd length restriction on nomDomaineType' % {"value" : value.encode("utf-8")} ) def validate_codeSTSType(self, value): # Validate type codeSTSType, a restriction on xsd:string. if value is not None and Validate_simpletypes_: if len(value) != 1: warnings_.warn('Value "%(value)s" does not match xsd length restriction on codeSTSType' % {"value" : value.encode("utf-8")} ) def validate_donneesComplType2(self, value): # Validate type donneesComplType2, a restriction on xsd:string. if value is not None and Validate_simpletypes_: if len(value) != 115: warnings_.warn('Value "%(value)s" does not match xsd length restriction on donneesComplType2' % {"value" : value.encode("utf-8")} ) def hasContent_(self): if ( self.numComplB2 is not None or self.numComplEDI is not None or self.numAdherent is not None or self.indicTraitement is not None or self.validiteDonnees is not None or self.codeRoutageFlux is not None or self.identHote is not None or self.nomDomaine is not None or self.codeSTS is not None or self.services is not None or self.donneesCompl is not None ): return True else: return False def export(self, outfile, level, namespace_='', name_='T_AsnAMC', namespacedef_='', pretty_print=True): 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_='T_AsnAMC') if self.hasContent_(): outfile.write('>%s' % (eol_, )) self.exportChildren(outfile, level + 1, namespace_='', name_='T_AsnAMC', pretty_print=pretty_print) showIndent(outfile, level, pretty_print) outfile.write('%s' % (namespace_, name_, eol_)) else: outfile.write('/>%s' % (eol_, )) def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='T_AsnAMC'): pass def exportChildren(self, outfile, level, namespace_='', name_='T_AsnAMC', fromsubclass_=False, pretty_print=True): if pretty_print: eol_ = '\n' else: eol_ = '' if self.numComplB2 is not None: showIndent(outfile, level, pretty_print) outfile.write('<%snumComplB2>%s%s' % (namespace_, self.gds_format_string(quote_xml(self.numComplB2).encode(ExternalEncoding), input_name='numComplB2'), namespace_, eol_)) if self.numComplEDI is not None: showIndent(outfile, level, pretty_print) outfile.write('<%snumComplEDI>%s%s' % (namespace_, self.gds_format_string(quote_xml(self.numComplEDI).encode(ExternalEncoding), input_name='numComplEDI'), namespace_, eol_)) if self.numAdherent is not None: showIndent(outfile, level, pretty_print) outfile.write('<%snumAdherent>%s%s' % (namespace_, self.gds_format_string(quote_xml(self.numAdherent).encode(ExternalEncoding), input_name='numAdherent'), namespace_, eol_)) if self.indicTraitement is not None: showIndent(outfile, level, pretty_print) outfile.write('<%sindicTraitement>%s%s' % (namespace_, self.gds_format_integer(self.indicTraitement, input_name='indicTraitement'), namespace_, eol_)) if self.validiteDonnees is not None: self.validiteDonnees.export(outfile, level, namespace_, name_='validiteDonnees', pretty_print=pretty_print) if self.codeRoutageFlux is not None: showIndent(outfile, level, pretty_print) outfile.write('<%scodeRoutageFlux>%s%s' % (namespace_, self.gds_format_string(quote_xml(self.codeRoutageFlux).encode(ExternalEncoding), input_name='codeRoutageFlux'), namespace_, eol_)) if self.identHote is not None: showIndent(outfile, level, pretty_print) outfile.write('<%sidentHote>%s%s' % (namespace_, self.gds_format_string(quote_xml(self.identHote).encode(ExternalEncoding), input_name='identHote'), namespace_, eol_)) if self.nomDomaine is not None: showIndent(outfile, level, pretty_print) outfile.write('<%snomDomaine>%s%s' % (namespace_, self.gds_format_string(quote_xml(self.nomDomaine).encode(ExternalEncoding), input_name='nomDomaine'), namespace_, eol_)) if self.codeSTS is not None: showIndent(outfile, level, pretty_print) outfile.write('<%scodeSTS>%s%s' % (namespace_, self.gds_format_string(quote_xml(self.codeSTS).encode(ExternalEncoding), input_name='codeSTS'), namespace_, eol_)) if self.services is not None: self.services.export(outfile, level, namespace_, name_='services', pretty_print=pretty_print) if self.donneesCompl is not None: showIndent(outfile, level, pretty_print) outfile.write('<%sdonneesCompl>%s%s' % (namespace_, self.gds_format_string(quote_xml(self.donneesCompl).encode(ExternalEncoding), input_name='donneesCompl'), namespace_, eol_)) def exportLiteral(self, outfile, level, name_='T_AsnAMC'): level += 1 already_processed = set() self.exportLiteralAttributes(outfile, level, already_processed, name_) if self.hasContent_(): self.exportLiteralChildren(outfile, level, name_) def exportLiteralAttributes(self, outfile, level, already_processed, name_): pass def exportLiteralChildren(self, outfile, level, name_): if self.numComplB2 is not None: showIndent(outfile, level) outfile.write('numComplB2=%s,\n' % quote_python(self.numComplB2).encode(ExternalEncoding)) if self.numComplEDI is not None: showIndent(outfile, level) outfile.write('numComplEDI=%s,\n' % quote_python(self.numComplEDI).encode(ExternalEncoding)) if self.numAdherent is not None: showIndent(outfile, level) outfile.write('numAdherent=%s,\n' % quote_python(self.numAdherent).encode(ExternalEncoding)) if self.indicTraitement is not None: showIndent(outfile, level) outfile.write('indicTraitement=%d,\n' % self.indicTraitement) if self.validiteDonnees is not None: showIndent(outfile, level) outfile.write('validiteDonnees=model_.T_AsnPeriode(\n') self.validiteDonnees.exportLiteral(outfile, level, name_='validiteDonnees') showIndent(outfile, level) outfile.write('),\n') if self.codeRoutageFlux is not None: showIndent(outfile, level) outfile.write('codeRoutageFlux=%s,\n' % quote_python(self.codeRoutageFlux).encode(ExternalEncoding)) if self.identHote is not None: showIndent(outfile, level) outfile.write('identHote=%s,\n' % quote_python(self.identHote).encode(ExternalEncoding)) if self.nomDomaine is not None: showIndent(outfile, level) outfile.write('nomDomaine=%s,\n' % quote_python(self.nomDomaine).encode(ExternalEncoding)) if self.codeSTS is not None: showIndent(outfile, level) outfile.write('codeSTS=%s,\n' % quote_python(self.codeSTS).encode(ExternalEncoding)) if self.services is not None: showIndent(outfile, level) outfile.write('services=model_.T_AsnServices(\n') self.services.exportLiteral(outfile, level, name_='services') showIndent(outfile, level) outfile.write('),\n') if self.donneesCompl is not None: showIndent(outfile, level) outfile.write('donneesCompl=%s,\n' % quote_python(self.donneesCompl).encode(ExternalEncoding)) 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_ == 'numComplB2': numComplB2_ = child_.text numComplB2_ = self.gds_validate_string(numComplB2_, node, 'numComplB2') self.numComplB2 = numComplB2_ self.validate_numComplB2Type(self.numComplB2) # validate type numComplB2Type elif nodeName_ == 'numComplEDI': numComplEDI_ = child_.text numComplEDI_ = self.gds_validate_string(numComplEDI_, node, 'numComplEDI') self.numComplEDI = numComplEDI_ self.validate_numComplEDIType(self.numComplEDI) # validate type numComplEDIType elif nodeName_ == 'numAdherent': numAdherent_ = child_.text numAdherent_ = self.gds_validate_string(numAdherent_, node, 'numAdherent') self.numAdherent = numAdherent_ self.validate_numAdherentType(self.numAdherent) # validate type numAdherentType elif nodeName_ == 'indicTraitement': sval_ = child_.text try: ival_ = int(sval_) except (TypeError, ValueError), exp: raise_parse_error(child_, 'requires integer: %s' % exp) ival_ = self.gds_validate_integer(ival_, node, 'indicTraitement') self.indicTraitement = ival_ self.validate_indicTraitementType1(self.indicTraitement) # validate type indicTraitementType1 elif nodeName_ == 'validiteDonnees': obj_ = T_AsnPeriode.factory() obj_.build(child_) self.validiteDonnees = obj_ obj_.original_tagname_ = 'validiteDonnees' elif nodeName_ == 'codeRoutageFlux': codeRoutageFlux_ = child_.text codeRoutageFlux_ = self.gds_validate_string(codeRoutageFlux_, node, 'codeRoutageFlux') self.codeRoutageFlux = codeRoutageFlux_ self.validate_codeRoutageFluxType(self.codeRoutageFlux) # validate type codeRoutageFluxType elif nodeName_ == 'identHote': identHote_ = child_.text identHote_ = self.gds_validate_string(identHote_, node, 'identHote') self.identHote = identHote_ self.validate_identHoteType(self.identHote) # validate type identHoteType elif nodeName_ == 'nomDomaine': nomDomaine_ = child_.text nomDomaine_ = self.gds_validate_string(nomDomaine_, node, 'nomDomaine') self.nomDomaine = nomDomaine_ self.validate_nomDomaineType(self.nomDomaine) # validate type nomDomaineType elif nodeName_ == 'codeSTS': codeSTS_ = child_.text codeSTS_ = self.gds_validate_string(codeSTS_, node, 'codeSTS') self.codeSTS = codeSTS_ self.validate_codeSTSType(self.codeSTS) # validate type codeSTSType elif nodeName_ == 'services': obj_ = T_AsnServices.factory() obj_.build(child_) self.services = obj_ obj_.original_tagname_ = 'services' elif nodeName_ == 'donneesCompl': donneesCompl_ = child_.text donneesCompl_ = self.gds_validate_string(donneesCompl_, node, 'donneesCompl') self.donneesCompl = donneesCompl_ self.validate_donneesComplType2(self.donneesCompl) # validate type donneesComplType2 # end class T_AsnAMC class T_AsnCMU(GeneratedsSuper): subclass = None superclass = None def __init__(self, typeCMU=None, periode=None): self.original_tagname_ = None self.typeCMU = typeCMU self.validate_typeCMUType(self.typeCMU) self.periode = periode def factory(*args_, **kwargs_): if T_AsnCMU.subclass: return T_AsnCMU.subclass(*args_, **kwargs_) else: return T_AsnCMU(*args_, **kwargs_) factory = staticmethod(factory) def get_typeCMU(self): return self.typeCMU def set_typeCMU(self, typeCMU): self.typeCMU = typeCMU def get_periode(self): return self.periode def set_periode(self, periode): self.periode = periode def validate_typeCMUType(self, value): # Validate type typeCMUType, a restriction on xsd:integer. if value is not None and Validate_simpletypes_: if len(str(value)) != 2: warnings_.warn('Value "%(value)s" does not match xsd length restriction on typeCMUType' % {"value" : value} ) def hasContent_(self): if ( self.typeCMU is not None or self.periode is not None ): return True else: return False def export(self, outfile, level, namespace_='', name_='T_AsnCMU', namespacedef_='', pretty_print=True): 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_='T_AsnCMU') if self.hasContent_(): outfile.write('>%s' % (eol_, )) self.exportChildren(outfile, level + 1, namespace_='', name_='T_AsnCMU', pretty_print=pretty_print) showIndent(outfile, level, pretty_print) outfile.write('%s' % (namespace_, name_, eol_)) else: outfile.write('/>%s' % (eol_, )) def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='T_AsnCMU'): pass def exportChildren(self, outfile, level, namespace_='', name_='T_AsnCMU', fromsubclass_=False, pretty_print=True): if pretty_print: eol_ = '\n' else: eol_ = '' if self.typeCMU is not None: showIndent(outfile, level, pretty_print) outfile.write('<%stypeCMU>%s%s' % (namespace_, self.gds_format_integer(self.typeCMU, input_name='typeCMU'), namespace_, eol_)) if self.periode is not None: self.periode.export(outfile, level, namespace_, name_='periode', pretty_print=pretty_print) def exportLiteral(self, outfile, level, name_='T_AsnCMU'): level += 1 already_processed = set() self.exportLiteralAttributes(outfile, level, already_processed, name_) if self.hasContent_(): self.exportLiteralChildren(outfile, level, name_) def exportLiteralAttributes(self, outfile, level, already_processed, name_): pass def exportLiteralChildren(self, outfile, level, name_): if self.typeCMU is not None: showIndent(outfile, level) outfile.write('typeCMU=%d,\n' % self.typeCMU) if self.periode is not None: showIndent(outfile, level) outfile.write('periode=model_.T_AsnPeriode(\n') self.periode.exportLiteral(outfile, level, name_='periode') showIndent(outfile, level) outfile.write('),\n') 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_ == 'typeCMU': sval_ = child_.text try: ival_ = int(sval_) except (TypeError, ValueError), exp: raise_parse_error(child_, 'requires integer: %s' % exp) ival_ = self.gds_validate_integer(ival_, node, 'typeCMU') self.typeCMU = ival_ self.validate_typeCMUType(self.typeCMU) # validate type typeCMUType elif nodeName_ == 'periode': obj_ = T_AsnPeriode.factory() obj_.build(child_) self.periode = obj_ obj_.original_tagname_ = 'periode' # end class T_AsnCMU class T_AsnAT(GeneratedsSuper): subclass = None superclass = None def __init__(self, orgGestion=None, codeBudget=None, identifiant=None): self.original_tagname_ = None self.orgGestion = orgGestion self.validate_orgGestionType(self.orgGestion) self.codeBudget = codeBudget self.validate_codeBudgetType(self.codeBudget) self.identifiant = identifiant self.validate_identifiantType(self.identifiant) def factory(*args_, **kwargs_): if T_AsnAT.subclass: return T_AsnAT.subclass(*args_, **kwargs_) else: return T_AsnAT(*args_, **kwargs_) factory = staticmethod(factory) def get_orgGestion(self): return self.orgGestion def set_orgGestion(self, orgGestion): self.orgGestion = orgGestion def get_codeBudget(self): return self.codeBudget def set_codeBudget(self, codeBudget): self.codeBudget = codeBudget def get_identifiant(self): return self.identifiant def set_identifiant(self, identifiant): self.identifiant = identifiant def validate_orgGestionType(self, value): # Validate type orgGestionType, a restriction on xsd:integer. if value is not None and Validate_simpletypes_: if len(str(value)) != 9: warnings_.warn('Value "%(value)s" does not match xsd length restriction on orgGestionType' % {"value" : value} ) def validate_codeBudgetType(self, value): # Validate type codeBudgetType, a restriction on xsd:string. if value is not None and Validate_simpletypes_: if len(value) != 2: warnings_.warn('Value "%(value)s" does not match xsd length restriction on codeBudgetType' % {"value" : value.encode("utf-8")} ) def validate_identifiantType(self, value): # Validate type identifiantType, a restriction on xsd:integer. if value is not None and Validate_simpletypes_: if len(str(value)) != 9: warnings_.warn('Value "%(value)s" does not match xsd length restriction on identifiantType' % {"value" : value} ) def hasContent_(self): if ( self.orgGestion is not None or self.codeBudget is not None or self.identifiant is not None ): return True else: return False def export(self, outfile, level, namespace_='', name_='T_AsnAT', namespacedef_='', pretty_print=True): 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_='T_AsnAT') if self.hasContent_(): outfile.write('>%s' % (eol_, )) self.exportChildren(outfile, level + 1, namespace_='', name_='T_AsnAT', pretty_print=pretty_print) showIndent(outfile, level, pretty_print) outfile.write('%s' % (namespace_, name_, eol_)) else: outfile.write('/>%s' % (eol_, )) def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='T_AsnAT'): pass def exportChildren(self, outfile, level, namespace_='', name_='T_AsnAT', fromsubclass_=False, pretty_print=True): if pretty_print: eol_ = '\n' else: eol_ = '' if self.orgGestion is not None: showIndent(outfile, level, pretty_print) outfile.write('<%sorgGestion>%s%s' % (namespace_, self.gds_format_integer(self.orgGestion, input_name='orgGestion'), namespace_, eol_)) if self.codeBudget is not None: showIndent(outfile, level, pretty_print) outfile.write('<%scodeBudget>%s%s' % (namespace_, self.gds_format_string(quote_xml(self.codeBudget).encode(ExternalEncoding), input_name='codeBudget'), namespace_, eol_)) if self.identifiant is not None: showIndent(outfile, level, pretty_print) outfile.write('<%sidentifiant>%s%s' % (namespace_, self.gds_format_integer(self.identifiant, input_name='identifiant'), namespace_, eol_)) def exportLiteral(self, outfile, level, name_='T_AsnAT'): level += 1 already_processed = set() self.exportLiteralAttributes(outfile, level, already_processed, name_) if self.hasContent_(): self.exportLiteralChildren(outfile, level, name_) def exportLiteralAttributes(self, outfile, level, already_processed, name_): pass def exportLiteralChildren(self, outfile, level, name_): if self.orgGestion is not None: showIndent(outfile, level) outfile.write('orgGestion=%d,\n' % self.orgGestion) if self.codeBudget is not None: showIndent(outfile, level) outfile.write('codeBudget=%s,\n' % quote_python(self.codeBudget).encode(ExternalEncoding)) if self.identifiant is not None: showIndent(outfile, level) outfile.write('identifiant=%d,\n' % self.identifiant) 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_ == 'orgGestion': sval_ = child_.text try: ival_ = int(sval_) except (TypeError, ValueError), exp: raise_parse_error(child_, 'requires integer: %s' % exp) ival_ = self.gds_validate_integer(ival_, node, 'orgGestion') self.orgGestion = ival_ self.validate_orgGestionType(self.orgGestion) # validate type orgGestionType elif nodeName_ == 'codeBudget': codeBudget_ = child_.text codeBudget_ = self.gds_validate_string(codeBudget_, node, 'codeBudget') self.codeBudget = codeBudget_ self.validate_codeBudgetType(self.codeBudget) # validate type codeBudgetType elif nodeName_ == 'identifiant': sval_ = child_.text try: ival_ = int(sval_) except (TypeError, ValueError), exp: raise_parse_error(child_, 'requires integer: %s' % exp) ival_ = self.gds_validate_integer(ival_, node, 'identifiant') self.identifiant = ival_ self.validate_identifiantType(self.identifiant) # validate type identifiantType # end class T_AsnAT class T_AsnListeAT(GeneratedsSuper): subclass = None superclass = None def __init__(self, at1=None, at2=None, at3=None): self.original_tagname_ = None self.at1 = at1 self.at2 = at2 self.at3 = at3 def factory(*args_, **kwargs_): if T_AsnListeAT.subclass: return T_AsnListeAT.subclass(*args_, **kwargs_) else: return T_AsnListeAT(*args_, **kwargs_) factory = staticmethod(factory) def get_at1(self): return self.at1 def set_at1(self, at1): self.at1 = at1 def get_at2(self): return self.at2 def set_at2(self, at2): self.at2 = at2 def get_at3(self): return self.at3 def set_at3(self, at3): self.at3 = at3 def hasContent_(self): if ( self.at1 is not None or self.at2 is not None or self.at3 is not None ): return True else: return False def export(self, outfile, level, namespace_='', name_='T_AsnListeAT', namespacedef_='', pretty_print=True): 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_='T_AsnListeAT') if self.hasContent_(): outfile.write('>%s' % (eol_, )) self.exportChildren(outfile, level + 1, namespace_='', name_='T_AsnListeAT', pretty_print=pretty_print) showIndent(outfile, level, pretty_print) outfile.write('%s' % (namespace_, name_, eol_)) else: outfile.write('/>%s' % (eol_, )) def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='T_AsnListeAT'): pass def exportChildren(self, outfile, level, namespace_='', name_='T_AsnListeAT', fromsubclass_=False, pretty_print=True): if pretty_print: eol_ = '\n' else: eol_ = '' if self.at1 is not None: self.at1.export(outfile, level, namespace_, name_='at1', pretty_print=pretty_print) if self.at2 is not None: self.at2.export(outfile, level, namespace_, name_='at2', pretty_print=pretty_print) if self.at3 is not None: self.at3.export(outfile, level, namespace_, name_='at3', pretty_print=pretty_print) def exportLiteral(self, outfile, level, name_='T_AsnListeAT'): level += 1 already_processed = set() self.exportLiteralAttributes(outfile, level, already_processed, name_) if self.hasContent_(): self.exportLiteralChildren(outfile, level, name_) def exportLiteralAttributes(self, outfile, level, already_processed, name_): pass def exportLiteralChildren(self, outfile, level, name_): if self.at1 is not None: showIndent(outfile, level) outfile.write('at1=model_.T_AsnAT(\n') self.at1.exportLiteral(outfile, level, name_='at1') showIndent(outfile, level) outfile.write('),\n') if self.at2 is not None: showIndent(outfile, level) outfile.write('at2=model_.T_AsnAT(\n') self.at2.exportLiteral(outfile, level, name_='at2') showIndent(outfile, level) outfile.write('),\n') if self.at3 is not None: showIndent(outfile, level) outfile.write('at3=model_.T_AsnAT(\n') self.at3.exportLiteral(outfile, level, name_='at3') showIndent(outfile, level) outfile.write('),\n') 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_ == 'at1': obj_ = T_AsnAT.factory() obj_.build(child_) self.at1 = obj_ obj_.original_tagname_ = 'at1' elif nodeName_ == 'at2': obj_ = T_AsnAT.factory() obj_.build(child_) self.at2 = obj_ obj_.original_tagname_ = 'at2' elif nodeName_ == 'at3': obj_ = T_AsnAT.factory() obj_.build(child_) self.at3 = obj_ obj_.original_tagname_ = 'at3' # end class T_AsnListeAT class T_AsnE112(GeneratedsSuper): subclass = None superclass = None def __init__(self, formulaire=None, typeExp=None, article=None, activite=None, date=None, validite=None): self.original_tagname_ = None self.formulaire = formulaire self.validate_formulaireType(self.formulaire) self.typeExp = typeExp self.validate_typeExpType(self.typeExp) self.article = article self.validate_articleType(self.article) self.activite = activite self.validate_activiteType(self.activite) self.date = date self.validate_T_AsnDate(self.date) self.validite = validite def factory(*args_, **kwargs_): if T_AsnE112.subclass: return T_AsnE112.subclass(*args_, **kwargs_) else: return T_AsnE112(*args_, **kwargs_) factory = staticmethod(factory) def get_formulaire(self): return self.formulaire def set_formulaire(self, formulaire): self.formulaire = formulaire def get_typeExp(self): return self.typeExp def set_typeExp(self, typeExp): self.typeExp = typeExp def get_article(self): return self.article def set_article(self, article): self.article = article def get_activite(self): return self.activite def set_activite(self, activite): self.activite = activite def get_date(self): return self.date def set_date(self, date): self.date = date def get_validite(self): return self.validite def set_validite(self, validite): self.validite = validite def validate_formulaireType(self, value): # Validate type formulaireType, a restriction on xsd:string. if value is not None and Validate_simpletypes_: if len(value) != 3: warnings_.warn('Value "%(value)s" does not match xsd length restriction on formulaireType' % {"value" : value.encode("utf-8")} ) def validate_typeExpType(self, value): # Validate type typeExpType, a restriction on xsd:integer. if value is not None and Validate_simpletypes_: if len(str(value)) != 1: warnings_.warn('Value "%(value)s" does not match xsd length restriction on typeExpType' % {"value" : value} ) def validate_articleType(self, value): # Validate type articleType, a restriction on xsd:integer. if value is not None and Validate_simpletypes_: if len(str(value)) != 3: warnings_.warn('Value "%(value)s" does not match xsd length restriction on articleType' % {"value" : value} ) def validate_activiteType(self, value): # Validate type activiteType, a restriction on xsd:string. if value is not None and Validate_simpletypes_: if len(value) != 1: warnings_.warn('Value "%(value)s" does not match xsd length restriction on activiteType' % {"value" : value.encode("utf-8")} ) def validate_T_AsnDate(self, value): # Validate type T_AsnDate, a restriction on xsd:integer. if value is not None and Validate_simpletypes_: if len(str(value)) != 8: warnings_.warn('Value "%(value)s" does not match xsd length restriction on T_AsnDate' % {"value" : value} ) def hasContent_(self): if ( self.formulaire is not None or self.typeExp is not None or self.article is not None or self.activite is not None or self.date is not None or self.validite is not None ): return True else: return False def export(self, outfile, level, namespace_='', name_='T_AsnE112', namespacedef_='', pretty_print=True): 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_='T_AsnE112') if self.hasContent_(): outfile.write('>%s' % (eol_, )) self.exportChildren(outfile, level + 1, namespace_='', name_='T_AsnE112', pretty_print=pretty_print) showIndent(outfile, level, pretty_print) outfile.write('%s' % (namespace_, name_, eol_)) else: outfile.write('/>%s' % (eol_, )) def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='T_AsnE112'): pass def exportChildren(self, outfile, level, namespace_='', name_='T_AsnE112', fromsubclass_=False, pretty_print=True): if pretty_print: eol_ = '\n' else: eol_ = '' if self.formulaire is not None: showIndent(outfile, level, pretty_print) outfile.write('<%sformulaire>%s%s' % (namespace_, self.gds_format_string(quote_xml(self.formulaire).encode(ExternalEncoding), input_name='formulaire'), namespace_, eol_)) if self.typeExp is not None: showIndent(outfile, level, pretty_print) outfile.write('<%stypeExp>%s%s' % (namespace_, self.gds_format_integer(self.typeExp, input_name='typeExp'), namespace_, eol_)) if self.article is not None: showIndent(outfile, level, pretty_print) outfile.write('<%sarticle>%s%s' % (namespace_, self.gds_format_integer(self.article, input_name='article'), namespace_, eol_)) if self.activite is not None: showIndent(outfile, level, pretty_print) outfile.write('<%sactivite>%s%s' % (namespace_, self.gds_format_string(quote_xml(self.activite).encode(ExternalEncoding), input_name='activite'), namespace_, eol_)) if self.date is not None: showIndent(outfile, level, pretty_print) outfile.write('<%sdate>%s%s' % (namespace_, self.gds_format_integer(self.date, input_name='date'), namespace_, eol_)) if self.validite is not None: self.validite.export(outfile, level, namespace_, name_='validite', pretty_print=pretty_print) def exportLiteral(self, outfile, level, name_='T_AsnE112'): level += 1 already_processed = set() self.exportLiteralAttributes(outfile, level, already_processed, name_) if self.hasContent_(): self.exportLiteralChildren(outfile, level, name_) def exportLiteralAttributes(self, outfile, level, already_processed, name_): pass def exportLiteralChildren(self, outfile, level, name_): if self.formulaire is not None: showIndent(outfile, level) outfile.write('formulaire=%s,\n' % quote_python(self.formulaire).encode(ExternalEncoding)) if self.typeExp is not None: showIndent(outfile, level) outfile.write('typeExp=%d,\n' % self.typeExp) if self.article is not None: showIndent(outfile, level) outfile.write('article=%d,\n' % self.article) if self.activite is not None: showIndent(outfile, level) outfile.write('activite=%s,\n' % quote_python(self.activite).encode(ExternalEncoding)) if self.date is not None: showIndent(outfile, level) outfile.write('date=%d,\n' % self.date) if self.validite is not None: showIndent(outfile, level) outfile.write('validite=model_.T_AsnPeriode(\n') self.validite.exportLiteral(outfile, level, name_='validite') showIndent(outfile, level) outfile.write('),\n') 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_ == 'formulaire': formulaire_ = child_.text formulaire_ = self.gds_validate_string(formulaire_, node, 'formulaire') self.formulaire = formulaire_ self.validate_formulaireType(self.formulaire) # validate type formulaireType elif nodeName_ == 'typeExp': sval_ = child_.text try: ival_ = int(sval_) except (TypeError, ValueError), exp: raise_parse_error(child_, 'requires integer: %s' % exp) ival_ = self.gds_validate_integer(ival_, node, 'typeExp') self.typeExp = ival_ self.validate_typeExpType(self.typeExp) # validate type typeExpType elif nodeName_ == 'article': sval_ = child_.text try: ival_ = int(sval_) except (TypeError, ValueError), exp: raise_parse_error(child_, 'requires integer: %s' % exp) ival_ = self.gds_validate_integer(ival_, node, 'article') self.article = ival_ self.validate_articleType(self.article) # validate type articleType elif nodeName_ == 'activite': activite_ = child_.text activite_ = self.gds_validate_string(activite_, node, 'activite') self.activite = activite_ self.validate_activiteType(self.activite) # validate type activiteType elif nodeName_ == 'date': sval_ = child_.text try: ival_ = int(sval_) except (TypeError, ValueError), exp: raise_parse_error(child_, 'requires integer: %s' % exp) ival_ = self.gds_validate_integer(ival_, node, 'date') self.date = ival_ self.validate_T_AsnDate(self.date) # validate type T_AsnDate elif nodeName_ == 'validite': obj_ = T_AsnPeriode.factory() obj_.build(child_) self.validite = obj_ obj_.original_tagname_ = 'validite' # end class T_AsnE112 class T_AsnBeneficiaire(GeneratedsSuper): subclass = None superclass = None def __init__(self, ident=None, amo=None, mutuelle=None, amc=None, cmu=None, listeAt=None, e112=None): self.original_tagname_ = None self.ident = ident self.amo = amo self.mutuelle = mutuelle self.amc = amc self.cmu = cmu self.listeAt = listeAt self.e112 = e112 def factory(*args_, **kwargs_): if T_AsnBeneficiaire.subclass: return T_AsnBeneficiaire.subclass(*args_, **kwargs_) else: return T_AsnBeneficiaire(*args_, **kwargs_) factory = staticmethod(factory) def get_ident(self): return self.ident def set_ident(self, ident): self.ident = ident def get_amo(self): return self.amo def set_amo(self, amo): self.amo = amo def get_mutuelle(self): return self.mutuelle def set_mutuelle(self, mutuelle): self.mutuelle = mutuelle def get_amc(self): return self.amc def set_amc(self, amc): self.amc = amc def get_cmu(self): return self.cmu def set_cmu(self, cmu): self.cmu = cmu def get_listeAt(self): return self.listeAt def set_listeAt(self, listeAt): self.listeAt = listeAt def get_e112(self): return self.e112 def set_e112(self, e112): self.e112 = e112 def hasContent_(self): if ( self.ident is not None or self.amo is not None or self.mutuelle is not None or self.amc is not None or self.cmu is not None or self.listeAt is not None or self.e112 is not None ): return True else: return False def export(self, outfile, level, namespace_='', name_='T_AsnBeneficiaire', namespacedef_='', pretty_print=True): 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_='T_AsnBeneficiaire') if self.hasContent_(): outfile.write('>%s' % (eol_, )) self.exportChildren(outfile, level + 1, namespace_='', name_='T_AsnBeneficiaire', pretty_print=pretty_print) showIndent(outfile, level, pretty_print) outfile.write('%s' % (namespace_, name_, eol_)) else: outfile.write('/>%s' % (eol_, )) def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='T_AsnBeneficiaire'): pass def exportChildren(self, outfile, level, namespace_='', name_='T_AsnBeneficiaire', fromsubclass_=False, pretty_print=True): if pretty_print: eol_ = '\n' else: eol_ = '' if self.ident is not None: self.ident.export(outfile, level, namespace_, name_='ident', pretty_print=pretty_print) if self.amo is not None: self.amo.export(outfile, level, namespace_, name_='amo', pretty_print=pretty_print) if self.mutuelle is not None: self.mutuelle.export(outfile, level, namespace_, name_='mutuelle', pretty_print=pretty_print) if self.amc is not None: self.amc.export(outfile, level, namespace_, name_='amc', pretty_print=pretty_print) if self.cmu is not None: self.cmu.export(outfile, level, namespace_, name_='cmu', pretty_print=pretty_print) if self.listeAt is not None: self.listeAt.export(outfile, level, namespace_, name_='listeAt', pretty_print=pretty_print) if self.e112 is not None: self.e112.export(outfile, level, namespace_, name_='e112', pretty_print=pretty_print) def exportLiteral(self, outfile, level, name_='T_AsnBeneficiaire'): level += 1 already_processed = set() self.exportLiteralAttributes(outfile, level, already_processed, name_) if self.hasContent_(): self.exportLiteralChildren(outfile, level, name_) def exportLiteralAttributes(self, outfile, level, already_processed, name_): pass def exportLiteralChildren(self, outfile, level, name_): if self.ident is not None: showIndent(outfile, level) outfile.write('ident=model_.T_AsnIdentification(\n') self.ident.exportLiteral(outfile, level, name_='ident') showIndent(outfile, level) outfile.write('),\n') if self.amo is not None: showIndent(outfile, level) outfile.write('amo=model_.T_AsnAMO(\n') self.amo.exportLiteral(outfile, level, name_='amo') showIndent(outfile, level) outfile.write('),\n') if self.mutuelle is not None: showIndent(outfile, level) outfile.write('mutuelle=model_.T_AsnMutuelle(\n') self.mutuelle.exportLiteral(outfile, level, name_='mutuelle') showIndent(outfile, level) outfile.write('),\n') if self.amc is not None: showIndent(outfile, level) outfile.write('amc=model_.T_AsnAMC(\n') self.amc.exportLiteral(outfile, level, name_='amc') showIndent(outfile, level) outfile.write('),\n') if self.cmu is not None: showIndent(outfile, level) outfile.write('cmu=model_.T_AsnCMU(\n') self.cmu.exportLiteral(outfile, level, name_='cmu') showIndent(outfile, level) outfile.write('),\n') if self.listeAt is not None: showIndent(outfile, level) outfile.write('listeAt=model_.T_AsnListeAT(\n') self.listeAt.exportLiteral(outfile, level, name_='listeAt') showIndent(outfile, level) outfile.write('),\n') if self.e112 is not None: showIndent(outfile, level) outfile.write('e112=model_.T_AsnE112(\n') self.e112.exportLiteral(outfile, level, name_='e112') showIndent(outfile, level) outfile.write('),\n') 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_ == 'ident': obj_ = T_AsnIdentification.factory() obj_.build(child_) self.ident = obj_ obj_.original_tagname_ = 'ident' elif nodeName_ == 'amo': obj_ = T_AsnAMO.factory() obj_.build(child_) self.amo = obj_ obj_.original_tagname_ = 'amo' elif nodeName_ == 'mutuelle': obj_ = T_AsnMutuelle.factory() obj_.build(child_) self.mutuelle = obj_ obj_.original_tagname_ = 'mutuelle' elif nodeName_ == 'amc': obj_ = T_AsnAMC.factory() obj_.build(child_) self.amc = obj_ obj_.original_tagname_ = 'amc' elif nodeName_ == 'cmu': obj_ = T_AsnCMU.factory() obj_.build(child_) self.cmu = obj_ obj_.original_tagname_ = 'cmu' elif nodeName_ == 'listeAt': obj_ = T_AsnListeAT.factory() obj_.build(child_) self.listeAt = obj_ obj_.original_tagname_ = 'listeAt' elif nodeName_ == 'e112': obj_ = T_AsnE112.factory() obj_.build(child_) self.e112 = obj_ obj_.original_tagname_ = 'e112' # end class T_AsnBeneficiaire class T_AsnInfosTechniques(GeneratedsSuper): subclass = None superclass = None def __init__(self, finValidite=None, numSerie=None, accesCompl=None): self.original_tagname_ = None self.finValidite = finValidite self.validate_T_AsnDate(self.finValidite) self.numSerie = numSerie self.validate_numSerieType(self.numSerie) self.accesCompl = accesCompl self.validate_accesComplType(self.accesCompl) def factory(*args_, **kwargs_): if T_AsnInfosTechniques.subclass: return T_AsnInfosTechniques.subclass(*args_, **kwargs_) else: return T_AsnInfosTechniques(*args_, **kwargs_) factory = staticmethod(factory) def get_finValidite(self): return self.finValidite def set_finValidite(self, finValidite): self.finValidite = finValidite def get_numSerie(self): return self.numSerie def set_numSerie(self, numSerie): self.numSerie = numSerie def get_accesCompl(self): return self.accesCompl def set_accesCompl(self, accesCompl): self.accesCompl = accesCompl def validate_T_AsnDate(self, value): # Validate type T_AsnDate, a restriction on xsd:integer. if value is not None and Validate_simpletypes_: if len(str(value)) != 8: warnings_.warn('Value "%(value)s" does not match xsd length restriction on T_AsnDate' % {"value" : value} ) def validate_numSerieType(self, value): # Validate type numSerieType, a restriction on xsd:integer. if value is not None and Validate_simpletypes_: if len(str(value)) > 12: warnings_.warn('Value "%(value)s" does not match xsd maxLength restriction on numSerieType' % {"value" : value} ) if len(str(value)) < 1: warnings_.warn('Value "%(value)s" does not match xsd minLength restriction on numSerieType' % {"value" : value} ) def validate_accesComplType(self, value): # Validate type accesComplType, a restriction on xsd:string. if value is not None and Validate_simpletypes_: if len(value) != 19: warnings_.warn('Value "%(value)s" does not match xsd length restriction on accesComplType' % {"value" : value.encode("utf-8")} ) def hasContent_(self): if ( self.finValidite is not None or self.numSerie is not None or self.accesCompl is not None ): return True else: return False def export(self, outfile, level, namespace_='', name_='T_AsnInfosTechniques', namespacedef_='', pretty_print=True): 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_='T_AsnInfosTechniques') if self.hasContent_(): outfile.write('>%s' % (eol_, )) self.exportChildren(outfile, level + 1, namespace_='', name_='T_AsnInfosTechniques', pretty_print=pretty_print) showIndent(outfile, level, pretty_print) outfile.write('%s' % (namespace_, name_, eol_)) else: outfile.write('/>%s' % (eol_, )) def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='T_AsnInfosTechniques'): pass def exportChildren(self, outfile, level, namespace_='', name_='T_AsnInfosTechniques', fromsubclass_=False, pretty_print=True): if pretty_print: eol_ = '\n' else: eol_ = '' if self.finValidite is not None: showIndent(outfile, level, pretty_print) outfile.write('<%sfinValidite>%s%s' % (namespace_, self.gds_format_integer(self.finValidite, input_name='finValidite'), namespace_, eol_)) if self.numSerie is not None: showIndent(outfile, level, pretty_print) outfile.write('<%snumSerie>%s%s' % (namespace_, self.gds_format_integer(self.numSerie, input_name='numSerie'), namespace_, eol_)) if self.accesCompl is not None: showIndent(outfile, level, pretty_print) outfile.write('<%saccesCompl>%s%s' % (namespace_, self.gds_format_string(quote_xml(self.accesCompl).encode(ExternalEncoding), input_name='accesCompl'), namespace_, eol_)) def exportLiteral(self, outfile, level, name_='T_AsnInfosTechniques'): level += 1 already_processed = set() self.exportLiteralAttributes(outfile, level, already_processed, name_) if self.hasContent_(): self.exportLiteralChildren(outfile, level, name_) def exportLiteralAttributes(self, outfile, level, already_processed, name_): pass def exportLiteralChildren(self, outfile, level, name_): if self.finValidite is not None: showIndent(outfile, level) outfile.write('finValidite=%d,\n' % self.finValidite) if self.numSerie is not None: showIndent(outfile, level) outfile.write('numSerie=%d,\n' % self.numSerie) if self.accesCompl is not None: showIndent(outfile, level) outfile.write('accesCompl=%s,\n' % quote_python(self.accesCompl).encode(ExternalEncoding)) 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_ == 'finValidite': sval_ = child_.text try: ival_ = int(sval_) except (TypeError, ValueError), exp: raise_parse_error(child_, 'requires integer: %s' % exp) ival_ = self.gds_validate_integer(ival_, node, 'finValidite') self.finValidite = ival_ self.validate_T_AsnDate(self.finValidite) # validate type T_AsnDate elif nodeName_ == 'numSerie': sval_ = child_.text try: ival_ = int(sval_) except (TypeError, ValueError), exp: raise_parse_error(child_, 'requires integer: %s' % exp) ival_ = self.gds_validate_integer(ival_, node, 'numSerie') self.numSerie = ival_ self.validate_numSerieType(self.numSerie) # validate type numSerieType elif nodeName_ == 'accesCompl': accesCompl_ = child_.text accesCompl_ = self.gds_validate_string(accesCompl_, node, 'accesCompl') self.accesCompl = accesCompl_ self.validate_accesComplType(self.accesCompl) # validate type accesComplType # end class T_AsnInfosTechniques class listeBenefType(GeneratedsSuper): subclass = None superclass = None def __init__(self, element=None): self.original_tagname_ = None if element is None: self.element = [] else: self.element = element def factory(*args_, **kwargs_): if listeBenefType.subclass: return listeBenefType.subclass(*args_, **kwargs_) else: return listeBenefType(*args_, **kwargs_) factory = staticmethod(factory) def get_element(self): return self.element def set_element(self, element): self.element = element def add_element(self, value): self.element.append(value) def insert_element_at(self, index, value): self.element.insert(index, value) def replace_element_at(self, index, value): self.element[index] = value def hasContent_(self): if ( self.element ): return True else: return False def export(self, outfile, level, namespace_='', name_='listeBenefType', namespacedef_='', pretty_print=True): 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_='listeBenefType') if self.hasContent_(): outfile.write('>%s' % (eol_, )) self.exportChildren(outfile, level + 1, namespace_='', name_='listeBenefType', pretty_print=pretty_print) showIndent(outfile, level, pretty_print) outfile.write('%s' % (namespace_, name_, eol_)) else: outfile.write('/>%s' % (eol_, )) def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='listeBenefType'): pass def exportChildren(self, outfile, level, namespace_='', name_='listeBenefType', fromsubclass_=False, pretty_print=True): if pretty_print: eol_ = '\n' else: eol_ = '' for element_ in self.element: element_.export(outfile, level, namespace_, name_='element', pretty_print=pretty_print) def exportLiteral(self, outfile, level, name_='listeBenefType'): level += 1 already_processed = set() self.exportLiteralAttributes(outfile, level, already_processed, name_) if self.hasContent_(): self.exportLiteralChildren(outfile, level, name_) def exportLiteralAttributes(self, outfile, level, already_processed, name_): pass def exportLiteralChildren(self, outfile, level, name_): showIndent(outfile, level) outfile.write('element=[\n') level += 1 for element_ in self.element: showIndent(outfile, level) outfile.write('model_.T_AsnBeneficiaire(\n') element_.exportLiteral(outfile, level, name_='T_AsnBeneficiaire') showIndent(outfile, level) outfile.write('),\n') level -= 1 showIndent(outfile, level) outfile.write('],\n') 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_ == 'element': obj_ = T_AsnBeneficiaire.factory() obj_.build(child_) self.element.append(obj_) obj_.original_tagname_ = 'element' # end class listeBenefType class naissanceType(GeneratedsSuper): subclass = None superclass = None def __init__(self, date=None, dateEnCarte=None): self.original_tagname_ = None self.date = date self.validate_T_AsnDate(self.date) self.dateEnCarte = dateEnCarte self.validate_dateEnCarteType(self.dateEnCarte) def factory(*args_, **kwargs_): if naissanceType.subclass: return naissanceType.subclass(*args_, **kwargs_) else: return naissanceType(*args_, **kwargs_) factory = staticmethod(factory) def get_date(self): return self.date def set_date(self, date): self.date = date def get_dateEnCarte(self): return self.dateEnCarte def set_dateEnCarte(self, dateEnCarte): self.dateEnCarte = dateEnCarte def validate_T_AsnDate(self, value): # Validate type T_AsnDate, a restriction on xsd:integer. if value is not None and Validate_simpletypes_: if len(str(value)) != 8: warnings_.warn('Value "%(value)s" does not match xsd length restriction on T_AsnDate' % {"value" : value} ) def validate_dateEnCarteType(self, value): # Validate type dateEnCarteType, a restriction on xsd:integer. if value is not None and Validate_simpletypes_: if len(str(value)) != 6: warnings_.warn('Value "%(value)s" does not match xsd length restriction on dateEnCarteType' % {"value" : value} ) def hasContent_(self): if ( self.date is not None or self.dateEnCarte is not None ): return True else: return False def export(self, outfile, level, namespace_='', name_='naissanceType', namespacedef_='', pretty_print=True): 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_='naissanceType') if self.hasContent_(): outfile.write('>%s' % (eol_, )) self.exportChildren(outfile, level + 1, namespace_='', name_='naissanceType', pretty_print=pretty_print) showIndent(outfile, level, pretty_print) outfile.write('%s' % (namespace_, name_, eol_)) else: outfile.write('/>%s' % (eol_, )) def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='naissanceType'): pass def exportChildren(self, outfile, level, namespace_='', name_='naissanceType', fromsubclass_=False, pretty_print=True): if pretty_print: eol_ = '\n' else: eol_ = '' if self.date is not None: showIndent(outfile, level, pretty_print) outfile.write('<%sdate>%s%s' % (namespace_, self.gds_format_integer(self.date, input_name='date'), namespace_, eol_)) if self.dateEnCarte is not None: showIndent(outfile, level, pretty_print) outfile.write('<%sdateEnCarte>%s%s' % (namespace_, self.gds_format_integer(self.dateEnCarte, input_name='dateEnCarte'), namespace_, eol_)) def exportLiteral(self, outfile, level, name_='naissanceType'): level += 1 already_processed = set() self.exportLiteralAttributes(outfile, level, already_processed, name_) if self.hasContent_(): self.exportLiteralChildren(outfile, level, name_) def exportLiteralAttributes(self, outfile, level, already_processed, name_): pass def exportLiteralChildren(self, outfile, level, name_): if self.date is not None: showIndent(outfile, level) outfile.write('date=%d,\n' % self.date) if self.dateEnCarte is not None: showIndent(outfile, level) outfile.write('dateEnCarte=%d,\n' % self.dateEnCarte) 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_ == 'date': sval_ = child_.text try: ival_ = int(sval_) except (TypeError, ValueError), exp: raise_parse_error(child_, 'requires integer: %s' % exp) ival_ = self.gds_validate_integer(ival_, node, 'date') self.date = ival_ self.validate_T_AsnDate(self.date) # validate type T_AsnDate elif nodeName_ == 'dateEnCarte': sval_ = child_.text try: ival_ = int(sval_) except (TypeError, ValueError), exp: raise_parse_error(child_, 'requires integer: %s' % exp) ival_ = self.gds_validate_integer(ival_, node, 'dateEnCarte') self.dateEnCarte = ival_ self.validate_dateEnCarteType(self.dateEnCarte) # validate type dateEnCarteType # end class naissanceType class listePeriodesDroitsType(GeneratedsSuper): subclass = None superclass = None def __init__(self, element=None): self.original_tagname_ = None if element is None: self.element = [] else: self.element = element def factory(*args_, **kwargs_): if listePeriodesDroitsType.subclass: return listePeriodesDroitsType.subclass(*args_, **kwargs_) else: return listePeriodesDroitsType(*args_, **kwargs_) factory = staticmethod(factory) def get_element(self): return self.element def set_element(self, element): self.element = element def add_element(self, value): self.element.append(value) def insert_element_at(self, index, value): self.element.insert(index, value) def replace_element_at(self, index, value): self.element[index] = value def hasContent_(self): if ( self.element ): return True else: return False def export(self, outfile, level, namespace_='', name_='listePeriodesDroitsType', namespacedef_='', pretty_print=True): 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_='listePeriodesDroitsType') if self.hasContent_(): outfile.write('>%s' % (eol_, )) self.exportChildren(outfile, level + 1, namespace_='', name_='listePeriodesDroitsType', pretty_print=pretty_print) showIndent(outfile, level, pretty_print) outfile.write('%s' % (namespace_, name_, eol_)) else: outfile.write('/>%s' % (eol_, )) def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='listePeriodesDroitsType'): pass def exportChildren(self, outfile, level, namespace_='', name_='listePeriodesDroitsType', fromsubclass_=False, pretty_print=True): if pretty_print: eol_ = '\n' else: eol_ = '' for element_ in self.element: element_.export(outfile, level, namespace_, name_='element', pretty_print=pretty_print) def exportLiteral(self, outfile, level, name_='listePeriodesDroitsType'): level += 1 already_processed = set() self.exportLiteralAttributes(outfile, level, already_processed, name_) if self.hasContent_(): self.exportLiteralChildren(outfile, level, name_) def exportLiteralAttributes(self, outfile, level, already_processed, name_): pass def exportLiteralChildren(self, outfile, level, name_): showIndent(outfile, level) outfile.write('element=[\n') level += 1 for element_ in self.element: showIndent(outfile, level) outfile.write('model_.T_AsnPeriode(\n') element_.exportLiteral(outfile, level, name_='T_AsnPeriode') showIndent(outfile, level) outfile.write('),\n') level -= 1 showIndent(outfile, level) outfile.write('],\n') 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_ == 'element': obj_ = T_AsnPeriode.factory() obj_.build(child_) self.element.append(obj_) obj_.original_tagname_ = 'element' # end class listePeriodesDroitsType class listeTypeContratType(GeneratedsSuper): subclass = None superclass = None def __init__(self, element=None): self.original_tagname_ = None if element is None: self.element = [] else: self.element = element def factory(*args_, **kwargs_): if listeTypeContratType.subclass: return listeTypeContratType.subclass(*args_, **kwargs_) else: return listeTypeContratType(*args_, **kwargs_) factory = staticmethod(factory) def get_element(self): return self.element def set_element(self, element): self.element = element def add_element(self, value): self.element.append(value) def insert_element_at(self, index, value): self.element.insert(index, value) def replace_element_at(self, index, value): self.element[index] = value def validate_elementType(self, value): # Validate type elementType, a restriction on xsd:string. if value is not None and Validate_simpletypes_: if len(value) > 40: warnings_.warn('Value "%(value)s" does not match xsd maxLength restriction on elementType' % {"value" : value.encode("utf-8")} ) if len(value) < 1: warnings_.warn('Value "%(value)s" does not match xsd minLength restriction on elementType' % {"value" : value.encode("utf-8")} ) def hasContent_(self): if ( self.element ): return True else: return False def export(self, outfile, level, namespace_='', name_='listeTypeContratType', namespacedef_='', pretty_print=True): 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_='listeTypeContratType') if self.hasContent_(): outfile.write('>%s' % (eol_, )) self.exportChildren(outfile, level + 1, namespace_='', name_='listeTypeContratType', pretty_print=pretty_print) showIndent(outfile, level, pretty_print) outfile.write('%s' % (namespace_, name_, eol_)) else: outfile.write('/>%s' % (eol_, )) def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='listeTypeContratType'): pass def exportChildren(self, outfile, level, namespace_='', name_='listeTypeContratType', fromsubclass_=False, pretty_print=True): if pretty_print: eol_ = '\n' else: eol_ = '' for element_ in self.element: showIndent(outfile, level, pretty_print) outfile.write('<%selement>%s%s' % (namespace_, self.gds_format_string(quote_xml(element_).encode(ExternalEncoding), input_name='element'), namespace_, eol_)) def exportLiteral(self, outfile, level, name_='listeTypeContratType'): level += 1 already_processed = set() self.exportLiteralAttributes(outfile, level, already_processed, name_) if self.hasContent_(): self.exportLiteralChildren(outfile, level, name_) def exportLiteralAttributes(self, outfile, level, already_processed, name_): pass def exportLiteralChildren(self, outfile, level, name_): showIndent(outfile, level) outfile.write('element=[\n') level += 1 for element_ in self.element: showIndent(outfile, level) outfile.write('%s,\n' % quote_python(element_).encode(ExternalEncoding)) level -= 1 showIndent(outfile, level) outfile.write('],\n') 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_ == 'element': element_ = child_.text element_ = self.gds_validate_string(element_, node, 'element') self.element.append(element_) self.validate_elementType(self.element) # validate type elementType # end class listeTypeContratType class listePeriodesType(GeneratedsSuper): subclass = None superclass = None def __init__(self, element=None): self.original_tagname_ = None if element is None: self.element = [] else: self.element = element def factory(*args_, **kwargs_): if listePeriodesType.subclass: return listePeriodesType.subclass(*args_, **kwargs_) else: return listePeriodesType(*args_, **kwargs_) factory = staticmethod(factory) def get_element(self): return self.element def set_element(self, element): self.element = element def add_element(self, value): self.element.append(value) def insert_element_at(self, index, value): self.element.insert(index, value) def replace_element_at(self, index, value): self.element[index] = value def hasContent_(self): if ( self.element ): return True else: return False def export(self, outfile, level, namespace_='', name_='listePeriodesType', namespacedef_='', pretty_print=True): 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_='listePeriodesType') if self.hasContent_(): outfile.write('>%s' % (eol_, )) self.exportChildren(outfile, level + 1, namespace_='', name_='listePeriodesType', pretty_print=pretty_print) showIndent(outfile, level, pretty_print) outfile.write('%s' % (namespace_, name_, eol_)) else: outfile.write('/>%s' % (eol_, )) def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='listePeriodesType'): pass def exportChildren(self, outfile, level, namespace_='', name_='listePeriodesType', fromsubclass_=False, pretty_print=True): if pretty_print: eol_ = '\n' else: eol_ = '' for element_ in self.element: element_.export(outfile, level, namespace_, name_='element', pretty_print=pretty_print) def exportLiteral(self, outfile, level, name_='listePeriodesType'): level += 1 already_processed = set() self.exportLiteralAttributes(outfile, level, already_processed, name_) if self.hasContent_(): self.exportLiteralChildren(outfile, level, name_) def exportLiteralAttributes(self, outfile, level, already_processed, name_): pass def exportLiteralChildren(self, outfile, level, name_): showIndent(outfile, level) outfile.write('element=[\n') level += 1 for element_ in self.element: showIndent(outfile, level) outfile.write('model_.T_AsnPeriode(\n') element_.exportLiteral(outfile, level, name_='T_AsnPeriode') showIndent(outfile, level) outfile.write('),\n') level -= 1 showIndent(outfile, level) outfile.write('],\n') 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_ == 'element': obj_ = T_AsnPeriode.factory() obj_.build(child_) self.element.append(obj_) obj_.original_tagname_ = 'element' # end class listePeriodesType GDSClassesMapping = { 'periode': T_AsnPeriode, 'naissance': naissanceType, 'periodeService': T_AsnPeriode, 't_AsnDonneesVitale': T_AsnDonneesVitale, 'mutuelle': T_AsnMutuelle, 'listeBenef': listeBenefType, 'listePeriodesDroits': listePeriodesDroitsType, 'service': T_AsnServiceAMO, 'listeAt': T_AsnListeAT, 'validiteDonnees': T_AsnPeriode, 'at2': T_AsnAT, 'at3': T_AsnAT, 'at1': T_AsnAT, 'listeTypeContrat': listeTypeContratType, 'amo': T_AsnAMO, 'amc': T_AsnAMC, 'listePeriodes': listePeriodesType, 'adresse': T_AsnAdresse, 'validite': T_AsnPeriode, 'services': T_AsnServices, 'ident': T_AsnIdentification, 'element': T_AsnPeriode, 'tech': T_AsnInfosTechniques, 'e112': T_AsnE112, 'cmu': T_AsnCMU, } USAGE_TEXT = """ Usage: python .py [ -s ] """ 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): doc = parsexml_(inFileName) rootNode = doc.getroot() rootTag, rootClass = get_root_tag(rootNode) if rootClass is None: rootTag = 'T_AsnDonneesVitale' rootClass = T_AsnDonneesVitale rootObj = rootClass.factory() rootObj.build(rootNode) # Enable Python to collect the space used by the DOM. doc = None if not silence: sys.stdout.write('\n') rootObj.export( sys.stdout, 0, name_=rootTag, namespacedef_='', pretty_print=True) return rootObj def parseEtree(inFileName, silence=False): doc = parsexml_(inFileName) rootNode = doc.getroot() rootTag, rootClass = get_root_tag(rootNode) if rootClass is None: rootTag = 'T_AsnDonneesVitale' rootClass = T_AsnDonneesVitale 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 doc = parsexml_(StringIO(inString)) rootNode = doc.getroot() rootTag, rootClass = get_root_tag(rootNode) if rootClass is None: rootTag = 'T_AsnDonneesVitale' rootClass = T_AsnDonneesVitale rootObj = rootClass.factory() rootObj.build(rootNode) # Enable Python to collect the space used by the DOM. doc = None if not silence: sys.stdout.write('\n') rootObj.export( sys.stdout, 0, name_=rootTag, namespacedef_='') return rootObj def parseLiteral(inFileName, silence=False): doc = parsexml_(inFileName) rootNode = doc.getroot() rootTag, rootClass = get_root_tag(rootNode) if rootClass is None: rootTag = 'T_AsnDonneesVitale' rootClass = T_AsnDonneesVitale 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 cvitale import *\n\n') sys.stdout.write('import cvitale 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__ = [ "T_AsnAMC", "T_AsnAMO", "T_AsnAT", "T_AsnAdresse", "T_AsnBeneficiaire", "T_AsnCMU", "T_AsnDonneesVitale", "T_AsnE112", "T_AsnIdentification", "T_AsnInfosTechniques", "T_AsnListeAT", "T_AsnMutuelle", "T_AsnPeriode", "T_AsnServiceAMO", "T_AsnServices", "listeBenefType", "listePeriodesDroitsType", "listePeriodesType", "listeTypeContratType", "naissanceType" ]