def __loadObject(self): objectsNode = self.__ctxt.xpathEval("//package/object") for objectNode in objectsNode: extendsObject = None propObj = objectNode.properties # look for the name of the object while propObj is not None: if propObj.name == "name": objectName = propObj.getContent() if propObj.name == "extends": extends = propObj.getContent() # Retrieve the father (inheritance) extendsObject = self.Jpackage.getObject(extends) if extendsObject == None: print( 'Class "%s" must be defined before being use as father class.\nPlease check that "%s" is defined before "%s".' % (extends, extends, objectName)) sys.exit(-4) propObj = propObj.next # creates the object newObject = objectGiws(objectName, extendsObject) # Load the methods methods = objectNode.children while methods is not None: if methods.type == "element": newObject.addMethod(self.__loadMethods(methods)) methods = methods.next # Add to the package the object found self.Jpackage.addObject(newObject) self.__ctxt.xpathFreeContext()
def __loadObject(self): objectsNode = self.__root.findall("object") for objectNode in objectsNode: # look for the name of the object objectName=objectNode.attrib["name"] # look for the hierarchy of the object extendsObject=None if "extends" in objectNode.attrib: extends=objectNode.attrib["extends"] # Retrieve the father (inheritance) extendsObject=self.Jpackage.getObject(extends) if extendsObject==None: print ('Class "%s" must be defined before being use as father class.\nPlease check that "%s" is defined before "%s".'%(extends, extends, objectName)) sys.exit(-4) # creates the object newObject=objectGiws(objectName,extendsObject) # Load the methods for child in objectNode.iter("method"): newObject.addMethod(self.__loadMethods(child)) # Add to the package the object found self.Jpackage.addObject(newObject)
def __loadObject(self): objectsNode = self.__root.findall("object") for objectNode in objectsNode: # look for the name of the object objectName = objectNode.attrib["name"] # look for the hierarchy of the object extendsObject = None if "extends" in objectNode.attrib: extends = objectNode.attrib["extends"] # Retrieve the father (inheritance) extendsObject = self.Jpackage.getObject(extends) if extendsObject == None: print( 'Class "%s" must be defined before being use as father class.\nPlease check that "%s" is defined before "%s".' % (extends, extends, objectName)) sys.exit(-4) # creates the object newObject = objectGiws(objectName, extendsObject) # Load the methods for child in objectNode.iter("method"): newObject.addMethod(self.__loadMethods(child)) # Add to the package the object found self.Jpackage.addObject(newObject)
def __loadObject(self): objectsNode = self.__ctxt.xpathEval("//package/object") for objectNode in objectsNode: extendsObject=None propObj=objectNode.properties # look for the name of the object while propObj is not None: if propObj.name=="name": objectName=propObj.getContent() if propObj.name=="extends": extends=propObj.getContent() # Retrieve the father (inheritance) extendsObject=self.Jpackage.getObject(extends) if extendsObject==None: print ('Class "%s" must be defined before being use as father class.\nPlease check that "%s" is defined before "%s".'%(extends, extends, objectName)) sys.exit(-4) propObj = propObj.next # creates the object newObject=objectGiws(objectName,extendsObject) # Load the methods methods=objectNode.children while methods is not None: if methods.type == "element": newObject.addMethod(self.__loadMethods(methods)) methods = methods.next # Add to the package the object found self.Jpackage.addObject(newObject) self.__ctxt.xpathFreeContext()