Beispiel #1
0
 def prepare(self):
   # before we do anything serious, check if we need to
   # bootstrap the schema for schema
   if self.schemas.has_key(XMLSchemaNS):
     # we're validating a schema with a (purported) schema for schemas,
     # or we're running useDTD=0
     sfors=self.schemas[XMLSchemaNS]
     self.sfors=sfors
     if ((not sfors.typeTable.has_key('string')) or
         (not sfors.typeTable['string'].__dict__.has_key('basetype')) or
         (sfors.typeTable['string'].basetype is None) or
         sfors.typeTable['string'].basetype.name is not AST):
       # need the ab-initio types
       sfors.targetNS=XMLSchemaNS
       self.current=sfors
       self.targetNS=XMLSchemaNS
       sfors.doBuiltIns(self)
   else:
     self.initSforS()
   self.sfors.nsdict={'xs':XMLSchemaNS}
   sforsi=Schema(self,None)
   self.schemas[XMLSchemaInstanceNS]=sforsi
   self.sforsi=sforsi
   sforsi.targetNS=XMLSchemaInstanceNS
   self.current=sforsi
   self.targetNS=XMLSchemaInstanceNS
   sforsi.installInstanceAttrs(self)
   sforsi.prepared=1
   self.current=self.sfors
   self.targetNS=XMLSchemaNS
   ec=0
   for sch in self.schemas.values():
     ec=ec+sch.errors
   self.prepared=1
   return ec
Beispiel #2
0
 def initSforS(self):
   sfors=Schema(self,None)
   self.schemas[XMLSchemaNS]=sfors
   self.sfors=sfors
   sfors.targetNS=XMLSchemaNS
   self.current=sfors
   self.targetNS=XMLSchemaNS
   sfors.doBuiltIns(self)