Diff for /xmlschema/applyschema.py between versions 1.41 and 1.42

version 1.41, 2000/04/24 15:00:09 version 1.42, 2000/04/24 15:08:34
Line 248  def validateChildTypes(children, schema) Line 248  def validateChildTypes(children, schema)
   for child in children:    for child in children:
     if child.__class__ == Element:      if child.__class__ == Element:
       if child.type:        if child.type:
         print child.type  
         child.type.validate(child,schema)          child.type.validate(child,schema)
       else:        else:
         verror(child,          verror(child,
Line 458  def vwarn(elt,message): Line 457  def vwarn(elt,message):
   sys.stderr.write(message)    sys.stderr.write(message)
   sys.stderr.write("\n")    sys.stderr.write("\n")
   
 if __name__=='__main__':  
   argl=sys.argv[1:]  
   k=0  
   while argl:  
     if argl[0]=='-k':  
       k=1  
     else:  
       break  
     argl=argl[1:]  
   
   if argl:  
     runit(argl[0],argl[1:],k)  
   else:  
     runit("tiny.xml",["tiny.xsd"],k)  
   
 # validation methods for schema components  # validation methods for schema components
   
 def validate(self,child,schema):  def av(self,child,schema):
   q = XMLSchema.QName(None,child.local,child.uri)    q = XMLSchema.QName(None,child.local,child.uri)
   vwarn(child,"allowing %s because it matched <any>" % q)    vwarn(child,"allowing %s because it matched <any>" % q)
   if child.type.processContents!='skip':    if child.type.processContents!='skip':
Line 490  def validate(self,child,schema): Line 475  def validate(self,child,schema):
         validateElement(child, e.typeDefinition, schema)          validateElement(child, e.typeDefinition, schema)
       elif child.type.processContents=='strict':        elif child.type.processContents=='strict':
         verror(child,"can't find a type for <any>-matching element %s" % q,schema)          verror(child,"can't find a type for <any>-matching element %s" % q,schema)
 XMLSchema.Any.validate=validate  XMLSchema.Any.validate=av
   
   def tv(self,child,schema):
     validateElement(child, self, schema)
   
   XMLSchema.Type.validate=tv
   
 def validate(self,child,schema):  # run at import if top
   validateElement(child, child.type, schema)  
   
 XMLSchema.Element.validate=validate  if __name__=='__main__':
     argl=sys.argv[1:]
     k=0
     while argl:
       if argl[0]=='-k':
         k=1
       else:
         break
       argl=argl[1:]
   
     if argl:
       runit(argl[0],argl[1:],k)
     else:
       runit("tiny.xml",["tiny.xsd"],k)
   
 # $Log$  # $Log$
 # Revision 1.41  2000/04/24 15:00:09  ht  # Revision 1.42  2000/04/24 15:08:34  ht
 # wholesale name changes -- init. caps for all classes,  # minor glitches, tiny.xml works again
 # schema.py -> XMLSchema.py  
 #  #
   # cleanup residual bugs with massive rename,
   # rename Any to Wildcard,
   # replace AnyAttribute with Wildcard,
   # get validation of Wildcard working in both element and attribute contexts
 #  #
 # Revision 1.42  2000/04/24 15:08:34  ht  # Revision 1.42  2000/04/24 15:08:34  ht
 # minor glitches, tiny.xml works again  # minor glitches, tiny.xml works again

Removed from v.1.41  
changed lines
  Added in v.1.42


Webmaster