Package glue :: Module LDBDWClient :: Class SimpleLWXMLParser
[hide private]
[frames] | no frames]

Class SimpleLWXMLParser

source code

A very simple LIGO_LW XML parser class that reads the only keeps tables that do not contain the strings sngl_ or multi_

The class is not very robust as can have problems if the line breaks do not appear in the standard places in the XML file.

Instance Methods [hide private]
 
__del__(self)
Destroys an instance by shutting down and deleting the parser.
source code
 
__init__(self)
Constructs an instance.
source code
 
end_element(self, name)
Callback for the end of an XML element.
source code
string
parse_line(self, line)
For each line we are passed, call the XML parser.
source code
 
start_element(self, name, attrs)
Callback for start of an XML element.
source code
Method Details [hide private]

__init__(self)
(Constructor)

source code 

Constructs an instance.

The private variable ignore_pat determines what tables we ignore.

end_element(self, name)

source code 

Callback for the end of an XML element. If the ignore flag is set, reset it so we start outputing the table again.

Parameters:
  • name (string) - the name of the tag being closed

parse_line(self, line)

source code 

For each line we are passed, call the XML parser. Returns the line if we are outside one of the ignored tables, otherwise returns the empty string.

Parameters:
  • line (string) - the line of the LIGO_LW XML file to be parsed
Returns: string
the line of XML passed in or the null string

start_element(self, name, attrs)

source code 

Callback for start of an XML element. Checks to see if we are about to start a table that matches the ignore pattern.

Parameters:
  • name (string) - the name of the tag being opened
  • attrs (dictionary) - a dictionary of the attributes for the tag being opened