Exemplo n.º 1
0
 def parsed(self, context):
     node = context.document
     # xsd root
     if node.name == 'schema' and Namespace.xsd(node.namespace()):
         self.examine(node)
         return
     # look deeper
     context = DocumentContext()
     for child in node:
         context.document = child
         self.parsed(context)
Exemplo n.º 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)