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

Class DataHandler

source code

object --+
         |
        DataHandler

Instance Methods [hide private]
 
__init__(self, validate)
Create a DataHandler object.
source code
 
read(self, handle)
Set up the parser and let it parse the XML results.
source code
 
parse(self, handle) source code
 
xmlDeclHandler(self, version, encoding, standalone) source code
 
startNamespaceDeclHandler(self, prefix, un) source code
 
startElementHandler(self, name, attrs) source code
 
endElementHandler(self, name) source code
 
characterDataHandler(self, content) source code
 
parse_xsd(self, root) source code
 
elementDecl(self, name, model)
Call a call-back function for each element declaration in a DTD.
source code
 
open_dtd_file(self, filename) source code
 
open_xsd_file(self, filename) source code
 
save_dtd_file(self, filename, text) source code
 
save_xsd_file(self, filename, text) source code
 
externalEntityRefHandler(self, context, base, systemId, publicId)
Handle external entiry reference in order to cache DTD locally.
source code
 
_initialize_directory(self)
Initialize the local DTD/XSD directories.
source code

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Class Variables [hide private]
  global_dtd_dir = '/tmp/test-install/lib/python2.7/site-package...
  global_xsd_dir = '/tmp/test-install/lib/python2.7/site-package...
  local_dtd_dir = ''
  local_xsd_dir = ''
Properties [hide private]
  directory

Inherited from object: __class__

Method Details [hide private]

__init__(self, validate)
(Constructor)

source code 
Create a DataHandler object.
Overrides: object.__init__

elementDecl(self, name, model)

source code 

Call a call-back function for each element declaration in a DTD.

This is used for each element declaration in a DTD like:

<!ELEMENT       name          (...)>

The purpose of this function is to determine whether this element should be regarded as a string, integer, list, dictionary, structure, or error.

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

source code 

Handle external entiry reference in order to cache DTD locally.

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. If new DTDs become available from NCBI, putting them in Bio/Entrez/DTDs will allow the parser to see them.

_initialize_directory(self)

source code 

Initialize the local DTD/XSD directories.

Added to allow for custom directory (cache) locations, for example when code is deployed on AWS Lambda.


Class Variable Details [hide private]

global_dtd_dir

Value:
'/tmp/test-install/lib/python2.7/site-packages/Bio/Entrez/DTDs'

global_xsd_dir

Value:
'/tmp/test-install/lib/python2.7/site-packages/Bio/Entrez/XSDs'

Property Details [hide private]

directory

Get Method:
unreachable.directory(self)
Set Method:
unreachable.directory(self, directory) - Allow user to set a custom directory, also triggering subdirectory initialization.