Package Bio :: Package Entrez :: Module Parser :: Class DataHandler
[hide private]
[frames] | no frames]

Class DataHandler

source code

Instance Methods [hide private]
 
__init__(self, dtd_dir) source code
 
run(self, handle)
Set up the parser and let it parse the XML results
source code
 
startElement(self, name, attrs) source code
 
endElement(self, name) source code
 
characters(self, content) source code
 
elementDecl(self, name, model)
This callback function is called for each element declaration: <!ELEMENT name (...)> encountered in a DTD.
source code
 
external_entity_ref_handler(self, context, base, systemId, publicId)
The purpose of this function is to load the DTD locally, instead of downloading it from the URL specified in the XML.
source code
 
load_definitions(self, filename)
This function is only needed if the XML does not specify a DTD.
source code
Method Details [hide private]

elementDecl(self, name, model)

source code 

This callback function is called for each element declaration: <!ELEMENT name (...)> encountered in a DTD. The purpose of this function is to determine whether this element should be regarded as a string, integer, list dictionary, structure, or error.

external_entity_ref_handler(self, context, base, systemId, publicId)

source code 

The purpose of this function is to load the DTD locally, instead of downloading it from the URL specified in the XML. Using the local DTD results in much faster parsing. If the DTD is not found locally, we try to download it. In practice, this may fail though, if the XML relies on many interrelated DTDs. If new DTDs appear, putting them in Bio/Entrez/DTDs will allow the parser to see them.

load_definitions(self, filename)

source code 

This function is only needed if the XML does not specify a DTD. As far as I can tell, this only occurs for EFetch results from the Journals database. Use a hand-written set of definitions instead.