ZSI Customizations

From PeformIQ Upgrade
Jump to navigation Jump to search

Disabling Explicit Type Strings in XML

In order to disable the inclusion of typing strings in the XML the following customisation was made to TCcompound.py script. This involved adding the line:

  kw['typed'] = 'False'

at line 435 of the file. This turns off the explicit typing within the XML.

             # anames and serialize them.  Only support one <any> in all content.
             # Must be self-describing instances
 
             # Regular handling of declared elements
             aname = what.aname
             v = f(aname)
 
             # print '@PLH@  what.__dict__ = "%s"' % what.__dict__
             # print '@PLH@  pname = "%s", v = "%s"' % (what.pname, v)
             # print '@PLH@  v = "%s"' % v
 
             indx += 1
             if what.minOccurs == 0 and v is None:
                 continue
 
             # Default to typecode, if self-describing instance, and check
             # to make sure it is derived from what.
             whatTC = what
             if whatTC.maxOccurs > 1 and v is not None:
                 if type(v) not in _seqtypes:
                     raise EvaluateException('pyobj (%s,%s), aname "%s": maxOccurs %s, expecting a %s' %(
                          self.nspname,self.pname,what.aname,whatTC.maxOccurs,_seqtypes),
                          sw.Backtrace(elt))
 
                 for v2 in v:
                     occurs += 1
                     if occurs > whatTC.maxOccurs:
                         raise EvaluateException('occurances (%d) exceeded maxOccurs(%d) for <%s>' %(
                                 occurs, whatTC.maxOccurs, what.pname),
                                 sw.Backtrace(elt))
 
                     what = _get_type_or_substitute(whatTC, v2, sw, elt)
 
                     # print '@PLH@ what = "%s"' % what
 
                     if debug and what is not whatTC:
                         self.logger.debug('substitute derived type: %s' %
                                           what.__class__)
 
                     # print '@PLH@ elem = "%s"\n   sw = "%s"\n  v2 = "%s"' % (elem, sw, v2)
 
                     what.serialize(elem, sw, v2, **kw)
 #                    try:
 #                        what.serialize(elem, sw, v2, **kw)
 #                    except Exception, e:
 #                        raise EvaluateException('Serializing %s.%s, %s %s' %
 #                            (n, whatTC.aname or '?', e.__class__.__name__, str(e)))
 
                 if occurs < whatTC.minOccurs:
                     raise EvaluateException(\
                         'occurances(%d) less than minOccurs(%d) for <%s>' %
                         (occurs, whatTC.minOccurs, what.pname), sw.Backtrace(elt))
 
                 continue
 
             if v is not None or what.nillable is True:
                 what = _get_type_or_substitute(whatTC, v, sw, elt)
                 if debug and what is not whatTC:
                     self.logger.debug('substitute derived type: %s' %
                                       what.__class__)
 
                 kw['typed'] = False
 
                 # print '@PLH@ elem = "%s"\n   sw = "%s"\n  v = "%s"  kw = "%s"' % (elem, sw, v, kw)
 
                 what.serialize(elem, sw, v, **kw)
 
 #                try:
 #                    what.serialize(elem, sw, v, **kw)
 #                except (ParseException, EvaluateException), e:
 #                    raise
 #                except Exception, e:
 #                    raise EvaluateException('Serializing %s.%s, %s %s' %
 #                        (n, whatTC.aname or '?', e.__class__.__name__, str(e)),
 #                        sw.Backtrace(elt))
                 continue
 
             raise EvaluateException('Got None for nillable(%s), minOccurs(%d) element (%s,%s), %s' %