Beispiel #1
0
def createClazzes(prefix, root):
    global DelayedElements
    processed = []
    
    DelayedElements = []
    elements = root.getChildren()
    createFromTree(prefix, elements, processed)
    while 1:
        if len(DelayedElements) <= 0:
            break
        element = DelayedElements.pop()
        name = get_clazz_name_from_element(element)
        if name not in processed:
            processed.append(name)
            createClazz(prefix, element)
    #
    # Create the elements that were postponed because we had not
    #   yet created their base class.
    while 1:
        if len(PostponedExtensions) <= 0:
            break
        element = PostponedExtensions.pop()
        parentName, parent = getParentName(element)
        if parentName:
            if (parentName in AlreadyGenerated or
                parentName in SimpleTypeDict.keys()):
                createClazz(prefix, element)
            else:
                PostponedExtensions.insert(0, element)
def createClazzes(prefix, root):
    processed = []

    elements = root.getChildren()
    createFromTree(prefix, elements, processed)

    # Create the elements that were postponed because we had not
    #   yet created their base class.
    while 1:
        if len(PostponedExtensions) <= 0:
            break
        element = PostponedExtensions.pop()
        parentName, dummy = getParentName(element)
        if parentName:
            if (parentName in AlreadyGenerated or
                parentName in SimpleTypeDict.keys()):
                createClazz(prefix, element)
            else:
                PostponedExtensions.insert(0, element)
Beispiel #3
0
def createClazzes(prefix, root):
    processed = []

    elements = root.getChildren()
    createFromTree(prefix, elements, processed)

    # Create the elements that were postponed because we had not
    #   yet created their base class.
    while 1:
        if len(PostponedExtensions) <= 0:
            break
        element = PostponedExtensions.pop()
        parentName, dummy = getParentName(element)
        if parentName:
            if (parentName in AlreadyGenerated
                    or parentName in SimpleTypeDict.keys()):
                createClazz(prefix, element)
            else:
                PostponedExtensions.insert(0, element)
Beispiel #4
0
def createClazz(prefix, element, processed):
    logging.debug("Generating class for: %s" % element)
    elementCleanName = get_clazz_name_from_element(element)
    processed.append(elementCleanName)
    if Clazz.ClazzDict.has_key(elementCleanName):
        return Clazz.ClazzDict[elementCleanName]

    parentName, base = getParentName(element)
    logging.debug("Element base: %s" % base)
    if not element.isExplicitDefine():
        logging.debug("Not an explicit define, returning.")
        return
    if element.getSimpleContent():
        logging.debug("Simple content, returning.")
        return
    # If this element is an extension (has a base) and the base has
    #   not been generated, then postpone it.
    if parentName:
        if (parentName not in AlreadyGenerated
                and parentName not in SimpleTypeDict.keys()):
            PostponedExtensions.append(element)
            return
    elementName = element.getName()
    if elementName in AlreadyGenerated:
        return
    AlreadyGenerated.append(elementName)
    if element.getMixedExtensionError():
        err_msg(
            '*** Element %s extension chain contains mixed and non-mixed content.  Not generated.\n'
            % (element.getName(), ))
        return
    new_clazz = Clazz(prefix, elementCleanName, parentName, element)
    # the access key form XSchemaElements to Clazzes is the
    # get_clazz_name_from_element(element)
    Clazz.ClazzDict[elementCleanName] = new_clazz

    createClazzMembers(new_clazz, element)

    parentName, dummy = getParentName(element)
    if parentName and parentName in AlreadyGenerated:
        new_clazz.parentName = mapName(cleanupName(parentName))
def createClazz(prefix, element, processed):
    logging.debug("Generating class for: %s" % element)
    elementCleanName = get_clazz_name_from_element(element)
    processed.append(elementCleanName)
    if Clazz.ClazzDict.has_key(elementCleanName):
        return Clazz.ClazzDict[elementCleanName]
    
    parentName, base = getParentName(element)
    logging.debug("Element base: %s" % base)
    if not element.isExplicitDefine():
        logging.debug("Not an explicit define, returning.")
        return
    if element.getSimpleContent():
        logging.debug("Simple content, returning.")
        return
    # If this element is an extension (has a base) and the base has
    #   not been generated, then postpone it.
    if parentName:
        if (parentName not in AlreadyGenerated and
            parentName not in SimpleTypeDict.keys()):
            PostponedExtensions.append(element)
            return
    elementName = element.getName()
    if elementName in AlreadyGenerated:
        return
    AlreadyGenerated.append(elementName)
    if element.getMixedExtensionError():
        err_msg('*** Element %s extension chain contains mixed and non-mixed content.  Not generated.\n' % (
            element.getName(), ))
        return
    new_clazz = Clazz(prefix, elementCleanName, parentName, element)
    # the access key form XSchemaElements to Clazzes is the
    # get_clazz_name_from_element(element)
    Clazz.ClazzDict[elementCleanName] = new_clazz
    
    createClazzMembers(new_clazz, element)
    
    parentName, dummy = getParentName(element)
    if parentName and parentName in AlreadyGenerated:
        new_clazz.parentName = mapName(cleanupName(parentName))