The package itools.xml also includes a handler class for XML files. The state of the handler is just the very same events the parser returns:
>>> from itools.xml import XMLFile
>>>
>>> document = XMLFile('hello.xml')
>>> for type, value, line in document.events:
... print 'Line:', line
... print 'Type:', type
... print 'Value:', repr(value)
... print
...
Line: 1
Type: 0
Value: ('1.0', 'UTF-8', None)
Line: 1
Type: 4
Value: '\n'
Line: 2
Type: 2
Value: (None, 'html', {})
This means that the same logic can be used to manipulate the stream of events returned by the parser or the list of events kept by the handler.