1.1 --- a/vContent.py Fri Oct 17 22:58:43 2008 +0200
1.2 +++ b/vContent.py Fri Oct 17 23:12:25 2008 +0200
1.3 @@ -266,7 +266,7 @@
1.4
1.5 if name == "BEGIN":
1.6 self.names.append(value)
1.7 - self.startElement(value, parameters)
1.8 + self.startComponent(value, parameters)
1.9
1.10 elif name == "END":
1.11 start_name = self.names.pop()
1.12 @@ -274,10 +274,10 @@
1.13 raise ParseError, "Mismatch in BEGIN and END declarations (%r and %r) at line %d." % (
1.14 start_name, value, f.line_number)
1.15
1.16 - self.endElement(value)
1.17 + self.endComponent(value)
1.18
1.19 else:
1.20 - self.handleComponent(name, parameters, value)
1.21 + self.handleProperty(name, parameters, value)
1.22
1.23 class Parser(ParserBase):
1.24
1.25 @@ -285,36 +285,36 @@
1.26
1.27 def __init__(self):
1.28 ParserBase.__init__(self)
1.29 - self.elements = [] # also known as components
1.30 + self.components = []
1.31
1.32 - def startElement(self, name, parameters):
1.33 + def startComponent(self, name, parameters):
1.34
1.35 """
1.36 - Add the element/component with the given 'name' and 'parameters',
1.37 - recording an empty list of children as part of the element's content.
1.38 + Add the component with the given 'name' and 'parameters', recording an
1.39 + empty list of children as part of the component's content.
1.40 """
1.41
1.42 - element = self.handleComponent(name, parameters, [])
1.43 - self.elements.append(element)
1.44 - return element
1.45 + component = self.handleProperty(name, parameters, [])
1.46 + self.components.append(component)
1.47 + return component
1.48
1.49 - def endElement(self, name):
1.50 + def endComponent(self, name):
1.51
1.52 """
1.53 - End the element with the given 'name' by removing it from the active
1.54 - element stack.
1.55 + End the component with the given 'name' by removing it from the active
1.56 + component stack.
1.57 """
1.58
1.59 - if len(self.elements) > 1:
1.60 - return self.elements.pop()
1.61 - elif self.elements:
1.62 - return self.elements[-1]
1.63 + if len(self.components) > 1:
1.64 + return self.components.pop()
1.65 + elif self.components:
1.66 + return self.components[-1]
1.67
1.68 - def handleComponent(self, name, parameters, value):
1.69 + def handleProperty(self, name, parameters, value):
1.70
1.71 """
1.72 Record the component with the given 'name', 'parameters' and 'value' as
1.73 - part of the current element's children.
1.74 + part of the current component's children.
1.75 """
1.76
1.77 component = self.makeComponent(name, parameters, value)
1.78 @@ -327,9 +327,9 @@
1.79
1.80 "Attach the given 'component' to its parent."
1.81
1.82 - if self.elements:
1.83 - element_name, element_parameters, element_children = self.elements[-1]
1.84 - element_children.append(component)
1.85 + if self.components:
1.86 + component_name, component_parameters, component_children = self.components[-1]
1.87 + component_children.append(component)
1.88
1.89 def makeComponent(self, name, parameters, value):
1.90
1.91 @@ -346,7 +346,7 @@
1.92 "Parse the contents of the file 'f'."
1.93
1.94 ParserBase.parse(self, f)
1.95 - return self.elements[0]
1.96 + return self.components[0]
1.97
1.98 # Public functions.
1.99