示例#1
0
 def skip(self, attr):
     """
     Get whether to skip (filter-out) the specified attribute.
     @param attr: An attribute.
     @type attr: I{Attribute}
     @return: True if should be skipped.
     @rtype: bool
     """
     ns = attr.namespace()
     skip = (
         Namespace.xmlns[1],
         'http://schemas.xmlsoap.org/soap/encoding/',
         'http://schemas.xmlsoap.org/soap/envelope/',
         'http://www.w3.org/2003/05/soap-envelope',
     )
     return ( Namespace.xs(ns) or ns[1] in skip )
示例#2
0
 def getprefixes(self):
     """
     Add prefixes foreach namespace referenced by parameter types.
     """
     namespaces = []
     for l in (self.params, self.types):
         for t,r in l:
             ns = r.namespace()
             if ns[1] is None: continue
             if ns[1] in namespaces: continue
             if Namespace.xs(ns) or Namespace.xsd(ns):
                 continue
             namespaces.append(ns[1])
             if t == r: continue
             ns = t.namespace()
             if ns[1] is None: continue
             if ns[1] in namespaces: continue
             namespaces.append(ns[1])
     i = 0
     namespaces.sort()
     for u in namespaces:
         p = self.nextprefix()
         ns = (p, u)
         self.prefixes.append(ns)