def __init__(self, xsdElement, parent): """ See *ElementRepresentative* for documentation. """ ElementRepresentative.__init__(self, xsdElement, parent) self.addSuperClassName(self.tagAttributes['base'])
def __init__(self, xsdElement, parent): """ See *ElementRepresentative* for documentation. """ ElementRepresentative.__init__(self, xsdElement, parent) self.addSuperClassName(self.tagAttributes['base'])
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
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
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
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)
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()
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)
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)
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)
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
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)
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)
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)
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)
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
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
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()
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()
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)
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)
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)
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)
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
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
def __init__(self, xsdElement, parent): """ See *ElementRepresentative* for documentation. """ ElementRepresentative.__init__(self, xsdElement, parent)
def __init__(self, xsdElement, parent): """ See *ElementRepresentative* for documentation. """ ElementRepresentative.__init__(self, xsdElement, parent)