示例#1
0
 def encode(self, node, content):
     if content.type.any():
         Typer.auto(node, content.value)
         return
     if content.real.any():
         Typer.auto(node, content.value)
         return
     ns = None
     name = content.real.name
     if self.xstq:
         ns = content.real.namespace()
     Typer.manual(node, name, ns)
示例#2
0
 def encode(self, node, content):
     # Add (soap) encoding information only if the resolved
     # type is derived by extension.  Further, the xsi:type values
     # is qualified by namespace only if the content (tag) and
     # referenced type are in different namespaces.
     if content.type.any():
         return
     if not content.real.extension():
         return
     if content.type.resolve() == content.real:
         return
     ns = None
     name = content.real.name
     if self.xstq:
         ns = content.real.namespace('ns1')
     Typer.manual(node, name, ns)