open_xmldoc#

gwpy.io.ligolw.open_xmldoc(
fobj: Readable,
contenthandler: type[ContentHandler] | None = None,
**kwargs,
) Document[source]#

Try and open an existing LIGO_LW-format file, or create a new Document.

Parameters:
fobjstr, file

file path or open file object to read

contenthandlerContentHandler, optional

the content handler with which to parse the document, if not given a default handler will be created using default_content_handler().

**kwargs

other keyword arguments to pass to load_fileobj() as appropriate

Returns:
xmldocDocument

either the Document as parsed from an existing file, or a new, empty Document