Package advene :: Package model :: Package parsers :: Module base_xml :: Class Stream
[hide private]
[frames] | no frames]

Class Stream

source code

object --+
         |
        Stream


Wrap the result of iterparse:
* start-ns and end-ns are interpreted, (prefix, uri) pairs being pushed
  and popped accordingly in attribute `namespaces`
* start and end events are accessible through the `event` and `elem`

Unlike iterators, a `Stream` has a notion of "current" item (accessible
through `event` and `elem`. To access the next element, the `forward`
method must be explicitly invoked. If it reaches the end, `event` and
`elem` will be None.

Note that a `Stream` is also iterable. The first yielded item will be the
current item. If the iteration is interrupted, the current item will be
the last yielded item.

Instance Methods [hide private]
 
__init__(self, filelike)
x.__init__(...) initializes x; see x.__class__.__doc__ for signature
source code
 
forward(self) source code
 
pushback(self)
Push the last item back in the stream.
source code
 
__iter__(self) source code

Inherited from object: __delattr__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __str__

Properties [hide private]
  event
  elem

Inherited from object: __class__

Method Details [hide private]

__init__(self, filelike)
(Constructor)

source code 

x.__init__(...) initializes x; see x.__class__.__doc__ for signature

Overrides: object.__init__
(inherited documentation)

pushback(self)

source code 

Push the last item back in the stream.

Note that no more than one item can be pushed back.

Limitation: this does not change `namespaces` accordingly!


Property Details [hide private]

event

Get Method:
unreachable.event(self)

elem

Get Method:
unreachable.elem(self)