title: Overriding namespace in array content
body: <p>I have following:</p>
  
  <pre><code>from spyne.service import ServiceBase
  from spyne.util import xml
  from spyne.model import complex, primitive
  
  
  class ComplexModel(complex.ComplexModelBase):
      __namespace__ = 'http://xml.candyshop.com/ns/candies/'
      __metaclass__ = complex.ComplexModelMeta
  
  
  class CandyModel(ComplexModel):
      __type_name__ = 'candy'
      flavor = complex.XmlAttribute(primitive.Unicode)
  
  
  class BagModel(ComplexModel):
      __type_name__ = 'bag'
      candies = complex.Array(CandyModel)
  
  
  class CandyShop(ServiceBase):
      __tns__ = 'http://xml.candyshop.com/ns/shop/'
  
      @rpc(_returns=primitive.AnyXml)
      def get_my_bag(ctx):
          bag = BagModel()
          bag.candies = [CandyModel(flavor='choco')]
          return xml.get_object_as_xml(
              bag,
              cls=BagModel,
              root_tag_name='bag',
          )
  
      @classmethod
      def dispatch(cls):
          from django.views.decorators.csrf import csrf_exempt
          from spyne.application import Application
          from spyne.server.django import DjangoApplication
  
          application = Application([cls],
              tns=cls.__tns__,
              in_protocol=Soap11(validator='lxml'),
              out_protocol=Soap11(cleanup_namespaces=True)
          )
          return csrf_exempt(DjangoApplication(application))
  
  
  shop_service = CandyShop.dispatch()
  </code></pre>
  
  <p>And result for <code>get_my_bag</code> is like:</p>
  
  <pre><code>&lt;tns:get_my_bagResult xmlns:tns="http://xml.candyshop.com/ns/shop/"&gt;
      &lt;ns0:bag xmlns:ns0="http://xml.candyshop.com/ns/candies/"&gt;
          &lt;ns0:candies&gt;
              &lt;ns1:candy xmlns:ns1="None" flavor="choco"/&gt;
          &lt;/ns0:candies&gt;
      &lt;/ns0:bag&gt;
  &lt;/tns:get_my_bagResult&gt;
  </code></pre>
  
  <p>But I want following:</p>
  
  <pre><code>&lt;tns:get_my_bagResult xmlns:tns="http://xml.candyshop.com/ns/shop/"&gt;
      &lt;ns0:bag xmlns:ns0="http://xml.candyshop.com/ns/candies/"&gt;
          &lt;ns0:candies&gt;
              &lt;ns0:specialCandy flavor="choco"/&gt;
          &lt;/ns0:candies&gt;
      &lt;/ns0:bag&gt;
  &lt;/tns:get_my_bagResult&gt;
  </code></pre>
  
  <p>So, how to customize type name for array content without definning new subclass? I tried
      <code>complex.Array(CandyModel.customize(type_name='specialCandy'))</code></p>
  
  <p>but this not works. Using of static <code>alias</code> method gives an empty <code>&lt;ns0:candies/&gt;</code>, maybe for that I'm still put <code>CandyModel</code> instances to the <code>candies</code> list, but this is my goal.</p>
  
  <p>Second, why there is <code>xmlns:ns1="None"</code> and how to fix it for <code>ns0</code>?</p>
  
  <p>BTW. Is there a way to customize namespace prefixes?</p>
  
  <hr>
  
  <h2>EDIT</h2>
  
  <pre><code>class Candies(complex.Array):
      __namespace__ = 'http://xml.candyshop.com/ns/candies/'
  </code></pre>
  
  <p>and</p>
  
  <pre><code>candies = Candies(CandyModel)
  </code></pre>
  
  <p>solves problem with namespaces, but its a workaround rather than solution. I prefer inline customization or some of mixin with my namespaced <code>ComplexModel</code>.</p>