Beispiel #1
0
 def __init__(self, xsdElement, parent):
     """
     See *ElementRepresentative* for documentation.
     """
     ElementRepresentative.__init__(self, xsdElement, parent)
     
     self.addSuperClassName(self.tagAttributes['base'])
Beispiel #2
0
    def __init__(self, xsdElement, parent):
        """
        See *ElementRepresentative* for documentation.
        """
        ElementRepresentative.__init__(self, xsdElement, parent)

        self.addSuperClassName(self.tagAttributes['base'])
Beispiel #3
0
    def __init__(self, xsdElement, parent):
        """
        See *ElementRepresentative* for documentation.
        """
        ElementRepresentative.__init__(self, xsdElement, parent)

        self.value = self.xsdElement.get('value')
        self.getContainingType().maxInclusive = self.value
Beispiel #4
0
    def __init__(self, xsdElement, parent):
        """
        Adds itself to the attribute dictionary in its containing
        type. See *ElementRepresentative* for documentation.
        """
        ElementRepresentative.__init__(self, xsdElement, parent)

        self.getContainingType().attributes[self.name] = self
Beispiel #5
0
    def __init__(self, xsdElement, parent):
        """
        See *ElementRepresentative* for documentation.
        """
        ElementRepresentative.__init__(self, xsdElement, parent)

        self.value                            = self.xsdElement.get('value')
        self.getContainingType().maxInclusive = self.value
Beispiel #6
0
    def __init__(self, xsdElement, parent):
        """
        Adds itself to the element list in its parent.
        See *ElementRepresentative* for documentation.
        """

        ElementRepresentative.__init__(self, xsdElement, parent)

        parent.elements.append(self)
Beispiel #7
0
    def __init__(self, xsdElement, parent):
        """
        See *ElementRepresentative* for documentation. Adds its documentation to the __doc__ field for the ER.
        """
        ElementRepresentative.__init__(self, xsdElement, parent)

        self.contType         = self.getContainingType()

        self.contType.__doc__ = xsdElement.text.strip()
Beispiel #8
0
    def __init__(self, xsdElement, parent):
        """
        See *ElementRepresentative* for documentation.
        """
        ElementRepresentative.__init__(self, xsdElement, parent)

        self.value = self.xsdElement.get('value')

        self.getContainingType().enumerations.append(self.value)
Beispiel #9
0
    def __init__(self, xsdElement, parent):
        """
        Adds itself to the element list in its parent.
        See *ElementRepresentative* for documentation.
        """

        ElementRepresentative.__init__(self, xsdElement, parent)

        parent.elements.append(self)
Beispiel #10
0
    def __init__(self, xsdElement, parent):
        """
        See *ElementRepresentative* for documentation.
        """
        ElementRepresentative.__init__(self, xsdElement, parent)

        self.value = self.xsdElement.get('value')

        self.getContainingType().enumerations.append(self.value)
Beispiel #11
0
    def __init__(self, xsdElement, parent):
        """
        See *ElementRepresentative* for documentation.
        """
        ElementRepresentative.__init__(self, xsdElement, parent)

        self.itemType = self.xsdElement.get('itemType')

        self.getContainingType().listItemType = self.itemType

        self.type = 'xs:list'  #the 'xs' is used so that it can be properly identified as a primitive data type later on
Beispiel #12
0
    def __init__(self, xsdElement, parent):
        """
        The `__init__` for this class' subclasses.
        Creates a blank list for enumerations.
        Creates a blank dictionary for attributes.
        See *ElementRepresentative* for documentation.
        """
        self.enumerations = []

        self.attributes  = {}
        
        ElementRepresentative.__init__(self, xsdElement, parent)
Beispiel #13
0
    def __init__(self, xsdElement, parent):
        """
        The `__init__` for this class' subclasses.
        Creates a blank list for enumerations.
        Creates a blank dictionary for attributes.
        See *ElementRepresentative* for documentation.
        """
        self.enumerations = []

        self.attributes = {}

        ElementRepresentative.__init__(self, xsdElement, parent)
Beispiel #14
0
    def __init__(self, xsdElement, parent):
        """
        Adds itself to the sequencesOrChoices list in its containing complexType.
        Makes a blank list for element children.
        Uses the ER '__init__`.
        See *ElementRepresentative* for more documentation.
        """
        self.elements = []

        ElementRepresentative.__init__(self, xsdElement, parent)

        self.getContainingType().sequencesOrChoices.append(self)
Beispiel #15
0
    def __init__(self, xsdElement, parent):
        """
        Adds itself to the sequencesOrChoices list in its containing complexType.
        Makes a blank list for element children.
        Uses the ER '__init__`.
        See *ElementRepresentative* for more documentation.
        """
        self. elements = []

        ElementRepresentative.__init__(self, xsdElement, parent)

        self.getContainingType().sequencesOrChoices.append(self)
Beispiel #16
0
    def __init__(self, xsdElement, parent):
        """
        Creates a dictionary for attributes.
        Adds itself to the attribute group dictionary in schema.        
        See *ElementRepresentative* for more documentation.
        """
        self.attributes = {}

        ElementRepresentative.__init__(self, xsdElement, parent)

        attrGroupContainer = self.parent.getContainingType()
        attrGroupContainer.attributeGroups[self.name] = self
        self.getSchema().attributeGroups[self.name] = self
Beispiel #17
0
    def __init__(self, xsdElement, parent):
        """
        Creates a dictionary for attributes.
        Adds itself to the attribute group dictionary in schema.        
        See *ElementRepresentative* for more documentation.
        """
        self.attributes = {}

        ElementRepresentative.__init__(self, xsdElement, parent)

        attrGroupContainer = self.parent.getContainingType()
        attrGroupContainer.attributeGroups[self.name] = self
        self.getSchema().attributeGroups[self.name] = self
Beispiel #18
0
    def processChildren(self):
        """
        There is a special processChildren() here to handle special types,
        which can be declared as a child of an element. If an element
        child can exist that is not a type, then this function will screw
        it up; however, as far as the developers knew at the time of writing
        this program, they cannot.

        No parameters.
        """
        children         = self.xsdElement.getchildren()

        if len(children) == 0: return None
        
        for child in children:

            processedChild = ElementRepresentative.factory(child, self)

            self.processedChildren.append(processedChild)

            self.type = processedChild.name

            self.tagAttributes['type'] = self.type

            processedChild.processChildren()
Beispiel #19
0
    def processChildren(self):
        """
        There is a special processChildren() here to handle special types,
        which can be declared as a child of an element. If an element
        child can exist that is not a type, then this function will screw
        it up; however, as far as the developers knew at the time of writing
        this program, they cannot.

        No parameters.
        """
        children = self.xsdElement.getchildren()

        if len(children) == 0: return None

        for child in children:

            processedChild = ElementRepresentative.factory(child, self)

            self.processedChildren.append(processedChild)

            self.type = processedChild.name

            self.tagAttributes['type'] = self.type

            processedChild.processChildren()
Beispiel #20
0
 def __str__(self):
     """
     Prints its name in a form that allows for quick identification
     of an element, without needing a bulky name that does not
     match the name used.
     """
     return "%s|%s|%s" % (ElementRepresentative.getContainingTypeName(self), \
                          self.__class__.__name__, self.name)
Beispiel #21
0
 def __str__(self):
     """
     Prints its name in a form that allows for quick identification
     of an element, without needing a bulky name that does not
     match the name used.
     """
     return "%s|%s|%s" % (ElementRepresentative.getContainingTypeName(self), \
                          self.__class__.__name__, self.name)
Beispiel #22
0
    def getType(self):
        """
        Returns its type from the class dictionary in *PyXSD*. The
        instance of *PyXSD* is attached to every element and attribute
        while the classes for the schema types are being built. Clearly,
        this function is used after the main ER run.
        """
        if not 'type' in self.__dict__:

            raise "Element.getType() Error: type is not in %s's dictionary."
            return None

        if self.type in self.pyXSD.classes.keys():
            return self.pyXSD.classes[self.type]
        
        return ElementRepresentative.typeFromName(self.type, self.pyXSD)
Beispiel #23
0
    def getType(self):
        """
        Returns its type from the class dictionary in *PyXSD*. The
        instance of *PyXSD* is attached to every element and attribute
        while the classes for the schema types are being built. Clearly,
        this function is used after the main ER run.
        """
        if not 'type' in self.__dict__:

            raise "Element.getType() Error: type is not in %s's dictionary."
            return None

        if self.type in self.pyXSD.classes.keys():
            return self.pyXSD.classes[self.type]

        return ElementRepresentative.typeFromName(self.type, self.pyXSD)
Beispiel #24
0
    def getName(self):
        """
        Mostly normal getName(), except it includes a means to make
        a type name if the type is the child of an element or
        some other tag. That name should look like this:

        `elementName`|`type tag type`

        No parameters
        """
        name = ElementRepresentative.getName(self)

        if not name == None: return name

        # We are implicitly defined in an element
        element = self.parent

        name = '%s|%s' % (element.name, self.tagType)

        element.typeName = name

        return name
Beispiel #25
0
    def getName(self):
        """
        Mostly normal getName(), except it includes a means to make
        a type name if the type is the child of an element or
        some other tag. That name should look like this:

        `elementName`|`type tag type`

        No parameters
        """
        name = ElementRepresentative.getName(self)
        
        if not name == None:    return name

        # We are implicitly defined in an element
        element  = self.parent
        
        name = '%s|%s' % (element.name, self.tagType) 
        
        element.typeName = name
        
        return name
Beispiel #26
0
 def __init__(self, xsdElement, parent):
     """
     See *ElementRepresentative* for documentation.
     """
     ElementRepresentative.__init__(self, xsdElement, parent)
Beispiel #27
0
 def __init__(self, xsdElement, parent):
     """
     See *ElementRepresentative* for documentation.
     """
     ElementRepresentative.__init__(self, xsdElement, parent)