示例#1
0
文件: Schema.py 项目: vimov/Deployer
 def installInstanceAttrs(self,sschema):
   sschema.eltStack=['a']              # hack
   for (attrn,basen) in _instanceAttrs:
     fake=attributeElt(sschema,None)
     fake.name=attrn
     fake.type=basen
     fake.init(None)
     fake.component.typeDefinitionName=QName(None,basen,
                                                       XMLSchemaNS)
     self.attributeTable[attrn]=fake.component
   for (attrn,itemn) in _instanceLists:
     fake=attributeElt(sschema,None)
     fake.name=attrn
     fake.simpleType=simpleTypeElt(sschema,None)
     fake.simpleType.list=listElt(sschema,None)
     fake.simpleType.list.init(None)
     fake.simpleType.list.component.itemtypeName=QName(None,itemn,
                                                                 XMLSchemaNS)
     fake.simpleType.init(None)
     fake.simpleType.component.variety='list'
     fake.simpleType.component.basetype=Type.urSimpleType
     fake.init(None)
     wf=Whitespace(sschema,None)
     wf.value='collapse'
     wf.fixed=1
     fake.simpleType.component.facets={'whiteSpace':wf}
     self.attributeTable[attrn]=fake.component
   sschema.eltStack=[]              # hack
   ap=Particle(sschema,None,
                         AnyAny(sschema,None),None)
   ap.term.processContents='lax'
   ap.occurs=(0,None)
示例#2
0
文件: Schema.py 项目: vimov/Deployer
 def doBuiltIns(self,sschema):
   self.doAbInitios(sschema)
   # TODO: implement fixed facets
   for (bitn,basen,facets,idt) in builtinTypeNames:
     fake=simpleTypeElt(sschema,None)
     fake.name=bitn
     fake.restriction=restrictionElt(sschema,None)
     fake.restriction.init(None)
     fake.init(None)
     fake.component.basetypeName=QName(None,basen,XMLSchemaNS)
     fake.component.variety='atomic'
     fake.component.idt=idt
     bit=fake.restriction.component
     bit.builtin=1
     bit.rootName=fake.component.basetype.rootName
     self.typeTable[bitn]=fake.component
     for (fc,fv) in facets:
       nf=fc(sschema,None)
       fake.restriction.facets[fc.name]=nf
       if fc.name=="pattern":
         nf.stringValue=fv
       else:
         nf.value=fv
   for (bitn,basen,idt) in builtinLists:
     fake=simpleTypeElt(sschema,None)
     fake.name=bitn
     fake.list=listElt(sschema,None)
     fake.list.init(None)
     fake.init(None)
     fake.component.basetype=Type.urSimpleType
     fake.component.variety='list'
     fake.list.component.itemtypeName=QName(None,basen,XMLSchemaNS)
     wf=Whitespace(sschema,None)
     wf.value='collapse'
     wf.fixed=1
     mf=MinLength(sschema,None)
     mf.value=1
     fake.component.facets={'whiteSpace':wf,'minLength':mf}
     fake.component.idt=idt
     self.typeTable[bitn]=fake.component
   ap=Particle(sschema,None,
                         AnyAny(sschema,None),None)
   ap.term.processContents='lax'
   ap.occurs=(0,None)
   if not Type.urType.model.term.particles:
     Type.urType.model.term.particles.append(ap)
     au=AttributeUse(sschema,None,
                               AnyAny(sschema,None),'optional')
     au.attributeDeclaration.processContents='lax'
     Type.urType.attributeDeclarations={'#any':au}
   else:
     shouldnt('dbl ur')
   self.typeTable['anyType']=Type.urType
   Type.urSimpleType.schema=Type.urType.schema=self
   Type.urSimpleType.sschema=Type.urType.sschema=sschema
   ws=Whitespace(sschema,None)
   ws.value="preserve"
   Type.urSimpleType.facets['whiteSpace']=ws
   self.typeTable['anySimpleType']=Type.urSimpleType
示例#3
0
文件: Schema.py 项目: vimov/Deployer
 def doAbInitios(self,sschema):
   wsf1=Whitespace(sschema,None)
   wsf1.value="collapse"
   wsf1.fixed="true"
   wsf2=Whitespace(sschema,None)
   wsf2.value="preserve"
   for (ain,ait) in abInitioTypes:
     aiti=ait(sschema)
     aiti.rootName=ain
     aiti.basetype=Type.urSimpleType
     if ain=='string':
       aiti.facets['whiteSpace']=wsf2
     else:
       aiti.facets['whiteSpace']=wsf1
     self.typeTable[ain]=aiti