gavo.votable.votparse module

Stream parsing of VOTables.

This module builds on a shallow wrapping of expat in utils.iterparse. There is an “almost-tight” parsing loop in the parse method. It builds an xmlstan tree (mainly through the _processNodeDefault method).

class gavo.votable.votparse.IGNORE[source]

Bases: object

this is a sentinel element used when an element is not known but robust parsing is requested.

These should not end up in a DOM, but if they do, they’re silent.

They’re designed to largely behave like stanxml Elements; it can’t autoconstruct, though.

apply(func)[source]
isEmpty()[source]
shouldBeSkipped()[source]
gavo.votable.votparse.parse(inFile, watchset=[], raiseOnInvalid=True)[source]

returns an iterator yielding items of interest.

inFile is a something that supports read(bytes)

watchset is a sequence of items of VOTable you want yielded. By default, that’s just VOTable.TABLE. You may want to see INFO or PARAM of certain protocols.

gavo.votable.votparse.parseBytes(string, watchset=[], raiseOnInvalid=True)[source]

returns an iterator yielding pairs of (table definition, row iterator).

string contains a VOTable literal as bytes (where we fall back to utf-8 encoding strings if necessary).

gavo.votable.votparse.readRaw(inFile)[source]

returns a V.VOTABLE instance with filled-in data for the input from inFile.