Package gavo :: Package utils :: Module plainxml :: Class iterparse
[frames] | no frames]

Class iterparse

source code

object --+
         |
        iterparse

iterates over start, data, and end events in source.

To keep things simple downstream, we swallow all namespace prefixes, if present.

iterparse is constructed with a source (anything that can read(source)) and optionally a custom error class. This error class needs to have the message as the first argument. Since expat error messages usually contain line number and column in them, no extra pos attribute is supported.

Since the parser typically is far ahead of the events seen, we do our own bookkeeping by storing the parser position with each event. The *end* of the construct that caused an event can be retrieved using pos.

Instance Methods
 
__init__(self, source, parseErrorClass=<class 'gavo.utils.excs.StructureError'>)
x.__init__(...) initializes x; see help(type(x)) for signature
source code
 
__iter__(self) source code
 
pushBack(self, type, name, payload) source code
 
next(self) source code
 
close(self) source code
 
getParseError(self, msg) source code

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

Class Variables
  chunkSize = 1048576
The number of bytes handed to expat from iterparse at one go.
Properties
  pos

Inherited from object: __class__

Method Details

__init__(self, source, parseErrorClass=<class 'gavo.utils.excs.StructureError'>)
(Constructor)

source code 

x.__init__(...) initializes x; see help(type(x)) for signature

Overrides: object.__init__
(inherited documentation)

Property Details

pos

Get Method:
unreachable.pos(self)