parse

astropy.io.votable.table.parse(source, columns=None, invalid='exception', pedantic=None, chunk_size=256, table_number=None, table_id=None, filename=None, _debug_python_based_parser=False) [edit on github][source]

Parses a VOTABLE xml file (or file-like object), and returns a VOTable object.

Parameters :

source : str or readable file-like object

Path or file object containing a VOTABLE xml file.

columns : sequence of str, optional

List of field names to include in the output. The default is to include all fields.

invalid : str, optional

One of the following values:

  • ‘exception’: throw an exception when an invalid value is encountered (default)
  • ‘mask’: mask out invalid values

pedantic : bool, optional

When True, raise an error when the file violates the spec, otherwise issue a warning. Warnings may be controlled using the standard Python mechanisms. See the warnings module in the Python standard library for more information. When not provided, uses the configuration setting astropy.io.votable.pedantic, which defaults to True.

chunk_size : int, optional

The number of rows to read before converting to an array. Higher numbers are likely to be faster, but will consume more memory.

table_number : int, optional

The number of table in the file to read in. If None, all tables will be read. If a number, 0 refers to the first table in the file, and only that numbered table will be parsed and read in. Should not be used with table_id.

table_id : str, optional

The ID of the table in the file to read in. Should not be used with table_number.

filename : str, optional

A filename, URL or other identifier to use in error messages. If filename is None and source is a string (i.e. a path), then source will be used as a filename for error messages. Therefore, filename is only required when source is a file-like object.

Returns :

votable : astropy.io.votable.tree.VOTableFile object

See also

astropy.io.votable.exceptions
The exceptions this function may raise.

Page Contents