code: def StartElement(self, name, attributes):
          '''
          Expat start element event handler
          '''
          if name == 'hierarchy':
              pass
          elif name == 'node':
              # Instantiate an Element object
              attributes['uniqueId'] = 'id/no_id/%d' % self.idCount
              bounds = re.split('[\][,]', attributes['bounds'])
              attributes['bounds'] = ((int(bounds[1]), int(bounds[2])), (int(bounds[4]), int(bounds[5])))
              if DEBUG_BOUNDS:
                  print >> sys.stderr, "bounds=", attributes['bounds']
              self.idCount += 1
              child = View.factory(attributes, self.device, version=self.version, uiAutomatorHelper=self.uiAutomatorHelper)
              self.views.append(child)
              # Push element onto the stack and make it a child of parent
              if not self.nodeStack:
                  self.root = child
              else:
                  self.parent = self.nodeStack[-1]
                  self.parent.add(child)
              self.nodeStack.append(childf StartElement(self, name, attributes):
          '''
          Expat start element event handler
          '''
          if name == 'hierarchy':
              pass
          elif name == 'node':
              # Instantiate an Element object
              attributes['uniqueId'] = 'id/no_id/%d' % self.idCount
              bounds = re.split('[\][,]', attributes['bounds'])
              attributes['bounds'] = ((int(bounds[1]), int(bounds[2])), (int(bounds[4]), int(bounds[5])))
              if DEBUG_BOUNDS:
                  print >> sys.stderr, "bounds=", attributes['bounds']
              self.idCount += 1
              child = View.factory(attributes, self.device, version=self.version, uiAutomatorHelper=self.uiAutomatorHelper)
              self.views.append(child)
              # Push element onto the stack and make it a child of parent
              if not self.nodeStack:
                  self.root = child
              else:
                  self.parent = self.nodeStack[-1]
                  self.parent.add(child)
              self.nodeStack.append(child)
docs: Expat start element event handler